UNPKG

vies-checker

Version:

Modern European VIES VAT number validator with full TypeScript support

36 lines (35 loc) 905 B
import { ViesUserError } from './interfaces.js'; /** * Custom error class for VIES API errors * * @example * ```typescript * try { * const result = await checkVAT('LU', '26375245'); * } catch (error) { * if (error instanceof ViesError) { * console.log(error.code); // 'TIMEOUT', 'SERVICE_UNAVAILABLE', etc. * if (error.isTransient()) { * // Retry logic * } * } * } * ``` */ export declare class ViesError extends Error { /** * The VIES error code */ readonly code: ViesUserError; constructor(code: ViesUserError, message?: string); /** * Check if error represents a rate limit * @returns true if the error is a rate limit error */ isRateLimitError(): boolean; /** * Check if error might be transient and worth retrying * @returns true if the error is likely temporary */ isTransient(): boolean; }