UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

132 lines 5.88 kB
import { Headers } from "./core.js"; export declare class OrbError extends Error { } export declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends OrbError { /** HTTP status for the response that caused the error */ readonly status: TStatus; /** HTTP headers for the response that caused the error */ readonly headers: THeaders; /** JSON body of the response that caused the error */ readonly error: TError; constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders); private static makeMessage; static generate(status: number | undefined, errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined): APIError; } export declare class APIUserAbortError extends APIError<undefined, undefined, undefined> { constructor({ message }?: { message?: string; }); } export declare class APIConnectionError extends APIError<undefined, undefined, undefined> { constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined; }); } export declare class APIConnectionTimeoutError extends APIConnectionError { constructor({ message }?: { message?: string; }); } export declare class BadRequestError extends APIError<400, Headers> { } export declare class AuthenticationError extends APIError<401, Headers> { } export declare class PermissionDeniedError extends APIError<403, Headers> { } export declare class NotFoundError extends APIError<404, Headers> { } export declare class ConflictError extends APIError<409, Headers> { } export declare class UnprocessableEntityError extends APIError<422, Headers> { } export declare class RateLimitError extends APIError<429, Headers> { } export declare class InternalServerError extends APIError<number, Headers> { } export declare class ConstraintViolation extends BadRequestError { status: 400; type: 'https://docs.withorb.com/reference/error-responses#400-constraint-violation'; detail?: string | null; title?: string | null; constructor(status: 400, error: Object, message: string | undefined, headers: Headers); } export declare class DuplicateResourceCreation extends BadRequestError { status: 400; type: 'https://docs.withorb.com/reference/error-responses#400-duplicate-resource-creation'; detail?: string | null; title?: string | null; constructor(status: 400, error: Object, message: string | undefined, headers: Headers); } export declare class FeatureNotAvailable extends BadRequestError { status: 400; type: 'https://docs.withorb.com/reference/error-responses#404-feature-not-available'; detail?: string | null; title?: string | null; constructor(status: 400, error: Object, message: string | undefined, headers: Headers); } export declare class RequestValidationError extends BadRequestError { status: 400; type: 'https://docs.withorb.com/reference/error-responses#400-request-validation-errors'; validation_errors: Array<unknown>; detail?: string | null; title?: string | null; constructor(status: 400, error: Object, message: string | undefined, headers: Headers); } export declare class OrbAuthenticationError extends AuthenticationError { status: 401; type: 'https://docs.withorb.com/reference/error-responses#401-authentication-error'; detail?: string | null; title?: string | null; constructor(status: 401, error: Object, message: string | undefined, headers: Headers); } export declare class ResourceNotFound extends NotFoundError { status: 404; title: string; type: 'https://docs.withorb.com/reference/error-responses#404-resource-not-found'; detail?: string | null; constructor(status: 404, error: Object, message: string | undefined, headers: Headers); } export declare class URLNotFound extends NotFoundError { status: 404; type: 'https://docs.withorb.com/reference/error-responses#404-url-not-found'; detail?: string | null; title?: string | null; constructor(status: 404, error: Object, message: string | undefined, headers: Headers); } export declare class ResourceConflict extends ConflictError { status: 409; type: 'https://docs.withorb.com/reference/error-responses#409-resource-conflict'; detail?: string | null; title?: string | null; constructor(status: 409, error: Object, message: string | undefined, headers: Headers); } export declare class RequestTooLarge extends APIError { status: 413; type: 'https://docs.withorb.com/reference/error-responses#413-request-too-large'; detail?: string | null; title?: string | null; constructor(status: 413, error: Object, message: string | undefined, headers: Headers); } export declare class ResourceTooLarge extends APIError { status: 413; type: 'https://docs.withorb.com/reference/error-responses#413-resource-too-large'; detail?: string | null; title?: string | null; constructor(status: 413, error: Object, message: string | undefined, headers: Headers); } export declare class TooManyRequests extends RateLimitError { status: 429; type: 'https://docs.withorb.com/reference/error-responses#429-too-many-requests'; detail?: string | null; title?: string | null; constructor(status: 429, error: Object, message: string | undefined, headers: Headers); } export declare class OrbInternalServerError extends InternalServerError { status: 500; type: 'https://docs.withorb.com/reference/error-responses#500-internal-server-error'; detail?: string | null; title?: string | null; constructor(status: 500, error: Object, message: string | undefined, headers: Headers); } //# sourceMappingURL=error.d.ts.map