UNPKG

@paydock/client-sdk

Version:

Paydock client sdk

55 lines 2.12 kB
import type { PURPOSE } from "../widget"; export declare const ERROR_CATEGORY: { readonly CONFIGURATION: "configuration"; readonly IDENTITY: "identity_access_management"; readonly INTERNAL: "internal"; readonly PROCESS: "process"; readonly RESOURCE: "resource"; readonly VALIDATION: "validation"; }; export type ErrorCategory = (typeof ERROR_CATEGORY)[keyof typeof ERROR_CATEGORY]; export declare const ERROR_CAUSE: { readonly ABORTED: "aborted"; readonly ACCESS_FORBIDDEN: "access_forbidden"; readonly ALREADY_EXISTS: "already_exists"; readonly CANCELED: "canceled"; readonly INVALID_CONFIGURATION: "invalid_configuration"; readonly INVALID_INPUT: "invalid_input"; readonly NOT_FOUND: "not_found"; readonly NOT_IMPLEMENTED: "not_implemented"; readonly RATE_LIMITED: "rate_limited"; readonly SERVER_BUSY: "server_busy"; readonly SERVICE_UNREACHABLE: "service_unreachable"; readonly UNAUTHORIZED: "unauthorized"; readonly UNKNOWN: "unknown_error"; readonly UNPROCESSABLE_ENTITY: "unprocessable_entity"; }; export type ErrorCause = (typeof ERROR_CAUSE)[keyof typeof ERROR_CAUSE]; export interface ErrorDetails { cause: ErrorCause; contextId: string; message: string; timestamp: string; } export interface IEventError { cause: ErrorCause; category: ErrorCategory; retryable: boolean; details: ErrorDetails; } export declare class EventError extends Error implements IEventError { readonly cause: ErrorCause; readonly category: ErrorCategory; readonly retryable: boolean; readonly details: ErrorDetails; purpose: PURPOSE; constructor(cause: ErrorCause, category: ErrorCategory, retryable: boolean, details: ErrorDetails); static create(cause: ErrorCause, message: string, contextId?: string, retryable?: boolean): EventError; toJSON(): { error: IEventError; }; setContextId(contextId: string): void; setPurpose(purpose: PURPOSE): void; } export declare function getErrorCategory(cause: ErrorCause): ErrorCategory; //# sourceMappingURL=event-error.d.ts.map