import { type ReadableError } from '../error'; import { BaseError } from 'make-error'; import { type DescriptorAssertionOptions } from './assert'; /** * Interface representing an assertion issue that occurred. * Contains information about the object and property that failed the assertion. * * @interface */ export interface AssertionIssue { /** * Object that encountered the issue. */ readonly target: object; /** * Property key that failed the assertion. */ readonly propertyKey: string; readonly options?: DescriptorAssertionOptions; } /** * Error code for assertion errors. */ export declare const ASSERTION_ERROR_CODE = "DBX_ASSERTION_ERROR"; /** * Error thrown when an assertion fails. * Extends BaseError and implements ReadableError interface. */ export declare class AssertionError extends BaseError implements ReadableError { readonly code = "DBX_ASSERTION_ERROR"; private readonly _target; private readonly _property; constructor(error: { target: object; propertyKey: string; }, message: string); /** * Gets the target object that failed the assertion. * * @returns The target object */ get target(): object; /** * Gets the property key that failed the assertion. * * @returns The property key as a string */ get propertyKey(): string; } /** * Handler for assertion issues that builds and throws appropriate errors. */ export declare class AssertionIssueHandler { /** * Handles an assertion issue by throwing an appropriate exception. * * @param error - The assertion issue to handle * @throws AssertionError */ handle(error: AssertionIssue): void; /** * Builds an AssertionError from an AssertionIssue. * * @param error - The assertion issue to build an exception from * @returns A new AssertionError instance */ buildException(error: AssertionIssue): AssertionError; /** * Builds an error message string from an AssertionIssue. * Uses the custom message if provided, otherwise creates a default message. * * @param error - The assertion issue to build a message for * @returns The error message string */ protected buildExceptionString(error: AssertionIssue): string; } /** * Default instance of AssertionIssueHandler used for handling assertion issues. * TODO: Allow changing, if needed. */ export declare const ASSERTION_HANDLER: AssertionIssueHandler;