forked from shioju/crawlee-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.js
45 lines (45 loc) · 1.59 KB
/
errors.js
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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SessionError = exports.RetryRequestError = exports.MissingRouteError = exports.CriticalError = exports.NonRetryableError = void 0;
/**
* Errors of `NonRetryableError` type will never be retried by the crawler.
*/
class NonRetryableError extends Error {
}
exports.NonRetryableError = NonRetryableError;
/**
* Errors of `CriticalError` type will shut down the whole crawler.
* Error handlers catching CriticalError should avoid logging it, as it will be logged by Node.js itself at the end
*/
class CriticalError extends NonRetryableError {
}
exports.CriticalError = CriticalError;
/**
* @ignore
*/
class MissingRouteError extends CriticalError {
}
exports.MissingRouteError = MissingRouteError;
/**
* Errors of `RetryRequestError` type will always be retried by the crawler.
*
* *This error overrides the `maxRequestRetries` option, i.e. the request can be retried indefinitely until it succeeds.*
*/
class RetryRequestError extends Error {
constructor(message) {
super(message ?? "Request is being retried at the user's request");
}
}
exports.RetryRequestError = RetryRequestError;
/**
* Errors of `SessionError` type will trigger a session rotation.
*
* This error doesn't respect the `maxRequestRetries` option and has a separate limit of `maxSessionRotations`.
*/
class SessionError extends RetryRequestError {
constructor(message) {
super(`Detected a session error, rotating session... ${message ? `\n${message}` : ''}`);
}
}
exports.SessionError = SessionError;
//# sourceMappingURL=errors.js.map