Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
send(safeLocal(localize, prefix, "cache_error", type));
} else if (error instanceof got.RequestError) {
send(safeLocal(localize, prefix, "request_error", type));
} else if (error instanceof got.ReadError) {
send(safeLocal(localize, prefix, "read_error", type));
} else if (error instanceof got.ParseError) {
send(safeLocal(localize, prefix, "parse_error", type));
} else if (error instanceof got.HTTPError) {
if (error.statusCode.startsWith("4")) {
send(safeLocal(localize, prefix, "4xx_error", type, error.statusCode));
} else if (error.statusCode.startsWith("5")) {
send(safeLocal(localize, prefix, "5xx_error", type, error.statusCode));
} else {
send(safeLocal(localize, prefix, "http_error", type, error.statusCode));
}
} else if (error instanceof got.MaxRedirectsError) {
send(safeLocal(localize, prefix, "redirect_error", type));
} else if (error instanceof got.UnsupportedProtocolError) {
send(safeLocal(localize, prefix, "protocol_error", type));
} else if (error instanceof got.CancelError) {
send(safeLocal(localize, prefix, "cancel_error", type));
} else if (error instanceof got.TimeoutError) {
send(safeLocal(localize, prefix, "timeout_error", type));
} else {
send(safeLocal(localize, prefix, "generic_error", type));
}
}