UNPKG

@unito/integration-sdk

Version:

Integration SDK

20 lines (19 loc) 1.12 kB
import * as HttpErrors from './httpErrors.js'; export declare class InvalidHandler extends Error { } /** * Parses a Retry-After header into a non-negative integer number of seconds to wait. Handles both the * delay-seconds and HTTP-date forms defined by RFC 9110, and rounds up so callers never retry earlier than * the provider asked. Returns undefined when the header is absent, blank, or unparseable. * * Internal to the SDK (errors.ts is not re-exported from index): the SDK populates HttpError.retryAfter * centrally in Provider.handleError, so integrations don't need to call this themselves. */ export declare function parseRetryAfterSeconds(headerValue: string | null | undefined): number | undefined; /** * Processes provider response codes and returns the corresponding errors to be translated further in our responses * * @param responseStatus the reponseStatus of the request. Any HTTP response code passed here will result in an error! * @param message The message returned by the provider */ export declare function buildHttpError(responseStatus: number, message: string): HttpErrors.HttpError;