Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!isNaN(error.cause)) {
const description = ERROR_CODES[error.cause] || http.STATUS_CODES[error.cause];
if (description) {
error.message = error.cause + ', ' + description;
}
}
});
const ParserError = create('ParserError', 3, function (error) {
error.message = BUG_REPORT + error.message;
});
// The following errors originate from promise-core and it's dependents.
// Give them an errorType for consistency.
original.StatusCodeError.prototype.errorType = 5;
original.TransformError.prototype.errorType = 6;
// This replaces the RequestError for all libraries using request/promise-core
// and prevents silent failure.
Object.defineProperty(original, 'RequestError', {
configurable: true,
enumerable: true,
writable: true,
value: RequestError
});
// Export our custom errors along with StatusCodeError, etc.
Object.assign(module.exports, original, {
RequestError: RequestError,
CaptchaError: CaptchaError,
ParserError: ParserError,
CloudflareError: CloudflareError