/** * A general message to ask user to try again later. */ declare const TRY_AGAIN_LATER = "Please try again later"; /** * A map of error types to secondary error messages. */ declare const SECONDARY_ERROR_MESSAGES: { MAX_RETRY: string; NO_TOKENS: string; USER_NOT_FOUND: string; GRAPHQL_ERROR: string; GITHUB_REST_API_ERROR: string; WAKATIME_USER_NOT_FOUND: string; INVALID_AFFILIATION: string; }; /** * Custom error class to handle custom GRS errors. */ declare class CustomError extends Error { type: string; secondaryMessage: string; /** * Custom error constructor. * * @param message Error message. * @param type Error type. */ constructor(message: string, type: string); static MAX_RETRY: string; static NO_TOKENS: string; static USER_NOT_FOUND: string; static GRAPHQL_ERROR: string; static GITHUB_REST_API_ERROR: string; static WAKATIME_ERROR: string; static INVALID_AFFILIATION: string; } /** * Missing query parameter class. */ declare class MissingParamError extends Error { missedParams: Array; secondaryMessage: string | undefined; /** * Missing query parameter error constructor. * * @param missedParams An array of missing parameters names. * @param secondaryMessage Optional secondary message to display. */ constructor(missedParams: Array, secondaryMessage?: string); } /** * Retrieve secondary message from an error object. * * @param err The error object. * @returns The secondary message if available, otherwise undefined. */ declare const retrieveSecondaryMessage: (err: Error) => string | undefined; /** * Structured details of a caught error for API results. */ export interface ErrorDetails { /** Error type such as `MAX_RETRY`. Absent when the error has no type. */ type?: string; message: string; secondaryMessage?: string; } /** * Extract structured details from a caught error. * * Callers attach the result to API results as an optional `error` field. * * @param err The caught error. * @returns The available error details. */ declare const describeError: (err: Error) => ErrorDetails; export { CustomError, MissingParamError, SECONDARY_ERROR_MESSAGES, TRY_AGAIN_LATER, describeError, retrieveSecondaryMessage, }; //# sourceMappingURL=error.d.ts.map