in src/common/error.ts [36:53]
export function isFailoverableError(error: any): boolean {
if (!isRestError(error)) {
return false;
}
// https://nodejs.org/api/errors.html#common-system-errors
// ENOTFOUND: DNS lookup failed, ENOENT: no such file or directory, ECONNREFUSED: connection refused, ECONNRESET: connection reset by peer, ETIMEDOUT: connection timed out
if (error.code !== undefined &&
(error.code === "ENOTFOUND" || error.code === "ENOENT" || error.code === "ECONNREFUSED" || error.code === "ECONNRESET" || error.code === "ETIMEDOUT")) {
return true;
}
// 401 Unauthorized, 403 Forbidden, 408 Request Timeout, 429 Too Many Requests, 5xx Server Errors
if (error.statusCode !== undefined &&
(error.statusCode === 401 || error.statusCode === 403 || error.statusCode === 408 || error.statusCode === 429 || error.statusCode >= 500)) {
return true;
}
return false;
}