forked from codemanki/cloudscraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.d.ts
95 lines (65 loc) · 2.84 KB
/
errors.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as rp from 'request-promise/errors';
import cloudscraper = require('.');
import http = require('http');
export interface RequestError extends rp.RequestError {
options: cloudscraper.Options;
errorType: 0;
}
export interface RequestErrorConstructor extends Error {
new(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): RequestError;
(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): RequestError;
prototype: RequestError;
}
export const RequestError: RequestErrorConstructor;
export interface CaptchaError extends rp.RequestError {
options: cloudscraper.Options;
errorType: 1;
}
export interface CaptchaErrorConstructor extends Error {
new(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): RequestError;
(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): RequestError;
prototype: CaptchaError;
}
export const CaptchaError: CaptchaErrorConstructor;
export interface CloudflareError extends rp.RequestError {
options: cloudscraper.Options;
errorType: 2 | 4;
}
export interface CloudflareErrorConstructor extends Error {
new(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): RequestError;
(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): RequestError;
prototype: CloudflareError;
}
export const CloudflareError: CloudflareErrorConstructor;
export interface ParserError extends rp.RequestError {
options: cloudscraper.Options;
errorType: 3;
}
export interface ParserErrorConstructor extends Error {
new(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): RequestError;
(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): RequestError;
prototype: ParserError;
}
export const ParserError: ParserErrorConstructor;
export interface StatusCodeError extends rp.RequestError {
options: cloudscraper.Options;
statusCode: number;
errorType: 5;
}
export interface StatusCodeErrorConstructor extends Error {
new(statusCode: number, body: any, options: cloudscraper.Options, response: http.IncomingMessage): StatusCodeError;
(statusCode: number, body: any, options: cloudscraper.Options, response: http.IncomingMessage): StatusCodeError;
prototype: StatusCodeError;
}
export const StatusCodeError: StatusCodeErrorConstructor;
export interface TransformError extends rp.RequestError {
options: cloudscraper.Options;
errorType: 6;
}
export interface TransformErrorConstructor extends Error {
new(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): TransformError;
(cause: any, options: cloudscraper.Options, response: http.IncomingMessage): TransformError;
prototype: TransformError;
}
export const TransformError: TransformErrorConstructor;