import { type Constructor } from 'type-fest'; /** * Either returns the input if it's already an Error instance or converts it into an Error instance. * * @category Error * @category Package : @augment-vir/common * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare function ensureError(maybeError: unknown): Error; /** * Ensures that the given input is an error and prepends the given message to the ensured Error * instance's message. * * @category Error * @category Package : @augment-vir/common * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare function ensureErrorAndPrependMessage(maybeError: unknown, prependMessage: string): Error; /** * Ensures that the given `originalError` is an instance of the given `errorClass`. * * - If it is, `originalError` is directly returned. * - If it is _not_, a new instance of `errorClass` is constructed with the given parameters. * * @category Error * @category Package : @augment-vir/common * @example * * ```ts * import {ensureErrorClass, extractErrorMessage} from '@augment-vir/common'; * * class MyCustomError extends Error { * public override readonly name = 'MyCustomError'; * } * * try { * // do some stuff * } catch (error) { * throw ensureErrorClass(error, MyCustomError, extractErrorMessage(error)); * } * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare function ensureErrorClass>(originalError: unknown, errorClass: ErrorClass, ...params: ConstructorParameters): InstanceType;