/** * Type definitions for API errors */ /** * ErrorOptions was introduced in ES2022, but we're currently targeting ES2018, so defining it here. */ interface ErrorOptions { cause?: unknown; } /** * TomTom API Error response format */ export interface TomTomErrorResponse { detailedError?: { code?: string; message?: string; }; error?: string; } /** * Custom error class with structured data */ export declare class ErrorWithData extends Error { readonly data: Record; readonly cause?: unknown; constructor(message: string, data?: Record, options?: ErrorOptions); toJSON(): { name: string; message: string; data: Record; stack: string | undefined; cause: unknown; }; } /** * Error category: The service is unavailable * Retrying is appropriate after ensuring the callee is healthy */ export declare class UnavailableError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: An operation was interrupted * Stopping the interruption is needed */ export declare class InterruptedError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: The system is busy/overloaded * Backing off and retrying is recommended */ export declare class BusyError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: The caller sent incorrect/invalid information * The caller's code needs fixing (not retryable) */ export declare class IncorrectError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: Access is forbidden * The caller needs proper credentials (not retryable) */ export declare class ForbiddenError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: The requested operation is not supported * The caller must use a different verb (not retryable) */ export declare class UnsupportedError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: The requested resource was not found * The caller must reference a different noun (not retryable) */ export declare class NotFoundError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: Conflict with the callee's state * Coordination between systems is required (not retryable) */ export declare class ConflictError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: Internal fault on the callee side * Fixing the callee's bug may help (potentially retryable) */ export declare class FaultError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } /** * Error category: Unknown error type * May be retryable depending on the underlying cause */ export declare class UnknownError extends ErrorWithData { constructor(message: string, data?: Record, options?: ErrorOptions); } export {};