UNPKG

@unito/integration-sdk

Version:

Integration SDK

69 lines (68 loc) 2.37 kB
/** * Error class meant to be returned by integrations in case of exceptions. These errors will be caught and handled * appropriately. Any other error would result in an unhandled server error accompanied by a 500 status code. * * @field message - The error message * @field status - The HTTP status code to return */ export declare class HttpError extends Error { readonly status: number; constructor(message: string, status: number); } /** * Used to generate a 400 Bad Request. Usually used when something is missing to properly handle the request. */ export declare class BadRequestError extends HttpError { constructor(message?: string); } /** * Used to generate a 401 Unauthorized. Usually used when the credentials are missing or invalid. */ export declare class UnauthorizedError extends HttpError { constructor(message?: string); } /** * Used to generate a 403 Forbidden. Usually used when user lacks sufficient permission to access a ressource. */ export declare class ForbiddenError extends HttpError { constructor(message?: string); } /** * Used to generate a 404 Not Found. Usually used when the requested `Item` is not found. */ export declare class NotFoundError extends HttpError { constructor(message?: string); } /** * Used to generate a 408 Timeout Error. Usually used when the call length exceeds the received Operation Deadline. */ export declare class TimeoutError extends HttpError { constructor(message?: string); } /** * Used to generate a 410 Resource Gone. * * @deprecated Use ProviderInstanceLockedError instead when the provider instance is locked or unavailable. */ export declare class ResourceGoneError extends HttpError { constructor(message?: string); } /** * Used to generate a 422 Unprocessable Entity. Usually used when an operation is invalid. */ export declare class UnprocessableEntityError extends HttpError { constructor(message?: string); } /** * Used to generate a 423 Provider Instance Locked. */ export declare class ProviderInstanceLockedError extends HttpError { constructor(message?: string); } /** * Used to generate a 429 Rate Limit Exceeded. Usually used when an operation triggers or would trigger a rate limit * error on the provider's side. */ export declare class RateLimitExceededError extends HttpError { constructor(message?: string); }