/** * Parameters for constructing a ViolationError */ export type ViolationErrorParam = { /** The specific type/category of the violation */ type: T; /** A human-readable description of what went wrong */ message: string; /** Optional structured data providing additional context about the error */ metadata?: Record; }; /** * ViolationError represents errors that require explicit handling in the system. * These are distinct from recoverable errors that can be automatically handled * by workflow logic. The explicit handling may be required for severe * violation of service contracts or explict retry handling * * Common violation scenarios include: * - Execution error like rate limit exceeded on external API calls * - Contract violations (invalid input/output) * - Configuration errors * - Permission/authorization failures */ export declare class ViolationError extends Error { /** The specific type/category of the violation */ readonly type: T; /** Additional structured data about the violation */ readonly metadata: Record | null; /** An additional flag to determine if it is an Arvo specific violation error */ readonly isArvoViolationError = true; /** * The error name, formatted as ViolationError * This helps with error identification in logs and stack traces */ readonly name: `ViolationError<${T}>`; constructor({ type, message, metadata }: ViolationErrorParam); } /** * Type guard to determine if an unknown value is a ViolationError, an instance * of a class that inherits from ViolationError. * * @param e - The value to check, typically an unknown error or exception * @returns `true` if the value is a ViolationError, inherits from it, or has the isArvoViolationError flag, `false` otherwise * * ```typescript * const error = new ViolationError({ * type: 'RATE_LIMIT', * message: 'API rate limit exceeded' * }); * * console.log(isViolationError(error)); // true * console.log(isViolationError(new Error())); // false * console.log(isViolationError(null)); // false * ``` */ export declare const isViolationError: (e: unknown) => boolean;