UNPKG

@eka-care/patient-ts-sdk

Version:

TypeScript SDK for Trinity Patient Profile Management System

71 lines (70 loc) 1.94 kB
/** * Custom error classes for the Trinity Profiles SDK */ /** * Base class for all SDK errors */ export declare class TrinitySDKError extends Error { readonly statusCode?: number; readonly response?: any; constructor(message: string, statusCode?: number, response?: any); } /** * Authentication error (401) */ export declare class AuthenticationError extends TrinitySDKError { constructor(message?: string, response?: any); } /** * Authorization error (403) */ export declare class AuthorizationError extends TrinitySDKError { constructor(message?: string, response?: any); } /** * Validation error (400) */ export declare class ValidationError extends TrinitySDKError { readonly validationErrors?: Record<string, string[]>; constructor(message: string, response?: any, validationErrors?: Record<string, string[]>); } /** * Not found error (404) */ export declare class NotFoundError extends TrinitySDKError { constructor(message?: string, response?: any); } /** * Conflict error (409) */ export declare class ConflictError extends TrinitySDKError { constructor(message?: string, response?: any); } /** * Server error (5xx) */ export declare class ServerError extends TrinitySDKError { constructor(message?: string, statusCode?: number, response?: any); } /** * Network error (connection issues) */ export declare class NetworkError extends TrinitySDKError { constructor(message?: string, response?: any); } /** * Timeout error */ export declare class TimeoutError extends TrinitySDKError { constructor(message?: string, response?: any); } /** * Rate limit error (429) */ export declare class RateLimitError extends TrinitySDKError { constructor(message?: string, response?: any); } /** * Create appropriate error based on HTTP status code */ export declare function createErrorFromResponse(statusCode: number, message: string, response?: any): TrinitySDKError;