credix
Version:
Official SDK for Credix Credit Management System
50 lines • 1.48 kB
TypeScript
/**
* Error details interface
*/
export interface ErrorDetails {
[key: string]: unknown;
}
/**
* Base error class for Credix
* Acts as a transparent proxy for API errors
*/
export declare class CredixError extends Error {
readonly code?: string;
readonly statusCode?: number;
readonly details?: ErrorDetails;
readonly requestId?: string;
readonly timestamp: Date;
constructor(message: string, statusCode?: number, code?: string, details?: ErrorDetails, requestId?: string);
/**
* Creates a CredixError from an HTTP response
* Transparently passes through API error information
*/
static fromResponse(statusCode: number, responseData: unknown, requestId?: string): CredixError;
/**
* Creates a CredixError from an unknown error
*/
static fromUnknown(error: unknown, defaultMessage?: string): CredixError;
/**
* Serializes the error to a plain object
*/
toJSON(): Record<string, unknown>;
}
/**
* Network-specific error
*/
export declare class NetworkError extends CredixError {
constructor(message: string, details?: ErrorDetails);
}
/**
* Timeout-specific error
*/
export declare class TimeoutError extends CredixError {
constructor(message: string, timeout: number);
}
/**
* Validation-specific error
*/
export declare class ValidationError extends CredixError {
constructor(message: string, field?: string, value?: unknown);
}
//# sourceMappingURL=credix-error.d.ts.map