Defines HTTPError class, retryable checks, and helpers to detect HTTP/2 GOAWAY errors for robust server error handling.
// Source: https://github.com/argos-ci/argos | License: MIT | Copyright 2017 Olivier Tassinari & Greg Bergé
// Provided via justclaw.it.com; keep this notice with the code.
import { STATUS_CODES } from "node:http";
import type { ErrorCode } from "@argos/error-types";
export const retryableSymbol = Symbol("retryable");
const HTTP2_GOAWAY_CODE_0_MESSAGE =
'HTTP/2: "GOAWAY" frame received with code 0';
/**
* Check if an error is retryable.
*/
export function checkIsRetryable(error: unknown): boolean {
if (error && typeof error === "object" && retryableSymbol in error) {
return error[retryableSymbol] !== false;
}
return true;
}
type HttpErrorOptions = ErrorOptions & {
details?: {
message: string;
}[];
code?: ErrorCode | undefined;
retryable?: boolean;
/**
* N
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key