Skip to content

Instantly share code, notes, and snippets.

@chalkygames123
Created December 9, 2025 00:05
Show Gist options
  • Select an option

  • Save chalkygames123/b00f1b526d87129abab020e04eb13750 to your computer and use it in GitHub Desktop.

Select an option

Save chalkygames123/b00f1b526d87129abab020e04eb13750 to your computer and use it in GitHub Desktop.
const RETRYABLE_HTTP_STATUS_CODES = new Set([
408, 425, 429, 500, 502, 503, 504,
]);
/**
* Determines whether the HTTP response status code indicates a transient error that can be retried.
*
* @returns Whether the status code indicates a transient error.
*/
export const isRetryableHttpStatusCode = (code: number): boolean => {
if (!Number.isInteger(code)) {
return false;
}
return RETRYABLE_HTTP_STATUS_CODES.has(code);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment