node-csfd-api
Version:
ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)
29 lines • 1.02 kB
text/typescript
//#region src/errors.d.ts
type CsfdErrorReason =
/** An anti-bot challenge stood in the way and could not be passed. */
'blocked' |
/** ČSFD answered 404 — the movie, creator or user does not exist. */
'not-found' |
/** Any other unsuccessful HTTP status. */
'http' |
/** The request never completed: offline, DNS, TLS, timeout. */
'network';
interface CsfdErrorOptions {
status?: number;
cause?: unknown;
}
/**
* Raised when a page cannot be retrieved. `reason` says why, so callers can
* tell "this movie does not exist" from "ČSFD is refusing us right now" and
* react differently instead of guessing from a message.
*/
declare class CsfdError extends Error {
readonly reason: CsfdErrorReason;
readonly url: string;
/** HTTP status, when the request got far enough to have one. */
readonly status?: number;
constructor(reason: CsfdErrorReason, url: string, message: string, options?: CsfdErrorOptions);
}
//#endregion
export { CsfdError, CsfdErrorReason };
//# sourceMappingURL=errors.d.cts.map