UNPKG

trainingpeaks-sdk

Version:
19 lines 1.17 kB
import { SDKError } from '../domain/errors/sdk-error.js'; export declare class ClientError extends SDKError { readonly operation: string; readonly suggestions: string[]; readonly isRetryable: boolean; readonly httpStatus?: number; constructor(message: string, code: string, operation: string, options?: { suggestions?: string[]; isRetryable?: boolean; httpStatus?: number; originalError?: Error; context?: Record<string, unknown>; }); } export declare const withClientErrorHandling: <T>(operation: () => Promise<T>, operationName: string, context?: Record<string, unknown>) => Promise<T>; export declare const transformToClientError: (error: Error, operation: string, context?: Record<string, unknown>) => ClientError; export declare const withClientResponseHandling: <TSuccess, TError>(operation: () => Promise<TSuccess>, operationName: string, errorResponseFactory: (error: string, code?: string) => TError, context?: Record<string, unknown>) => Promise<TSuccess | TError>; export declare const createUserFriendlyMessage: (error: ClientError) => string; //# sourceMappingURL=sdk-error-handler.d.ts.map