@nutrient-sdk/dws-client-typescript
Version:
Node.js TypeScript client library for Nutrient Document Web Services (DWS) API
59 lines • 1.89 kB
TypeScript
/**
* Base error class for all Nutrient DWS client errors.
* Provides consistent error handling across the library.
*/
export declare class NutrientError extends Error {
/**
* Error code for programmatic error handling
*/
readonly code: string;
/**
* Additional error details
*/
readonly details?: Record<string, unknown>;
/**
* HTTP status code if the error originated from an HTTP response
*/
readonly statusCode?: number;
constructor(message: string, code?: string, details?: Record<string, unknown>, statusCode?: number);
/**
* Returns a JSON representation of the error
*/
toJSON(): Record<string, unknown>;
/**
* Returns a string representation of the error
*/
toString(): string;
/**
* Wraps an unknown error into a NutrientError
* @param error - The error to wrap
* @param message - Optional message to prepend
* @returns A NutrientError instance
*/
static wrap(error: unknown, message?: string): NutrientError;
}
/**
* Error thrown when input validation fails
*/
export declare class ValidationError extends NutrientError {
constructor(message: string, details?: Record<string, unknown>, statusCode?: number);
}
/**
* Error thrown when API requests fail
*/
export declare class APIError extends NutrientError {
constructor(message: string, statusCode: number, details?: Record<string, unknown>);
}
/**
* Error thrown when authentication fails
*/
export declare class AuthenticationError extends NutrientError {
constructor(message: string, details?: Record<string, unknown>, statusCode?: number);
}
/**
* Error thrown when network requests fail
*/
export declare class NetworkError extends NutrientError {
constructor(message: string, details?: Record<string, unknown>, statusCode?: number);
}
//# sourceMappingURL=errors.d.ts.map