UNPKG

@mikkelscheike/email-provider-links

Version:

TypeScript library for email provider detection with 140 providers (259 domains), concurrent DNS resolution, alias normalization, and HTTPS login URL validation for login and password reset flows

56 lines 1.46 kB
/** * Error handling utilities * * Provides consistent error handling patterns across the codebase. */ /** * Extracts a human-readable error message from an unknown error value. * * @param error - The error value (Error, string, or unknown) * @returns A string error message * * @example * ```typescript * try { * // some operation * } catch (error: unknown) { * const message = getErrorMessage(error); * console.error(message); * } * ``` */ export declare function getErrorMessage(error: unknown): string; /** * Extracts an error code from an unknown error value. * * @param error - The error value * @returns The error code if available, undefined otherwise * * @example * ```typescript * try { * // some operation * } catch (error: unknown) { * const code = getErrorCode(error); * if (code === 'ENOENT') { * // handle file not found * } * } * ``` */ export declare function getErrorCode(error: unknown): string | undefined; /** * Checks if an error is a file not found error (ENOENT). * * @param error - The error value * @returns true if the error is a file not found error */ export declare function isFileNotFoundError(error: unknown): boolean; /** * Checks if an error is a JSON parsing error. * * @param error - The error value * @returns true if the error is a JSON parsing error */ export declare function isJsonError(error: unknown): boolean; //# sourceMappingURL=error-utils.d.ts.map