import { Value } from '../../function/function/nullary'; import { ExceptionContext } from '../exception/exception-context'; import { ExceptionTokens } from '../exception/exception-tokens'; /** * A function that throws an {@linkcode Error}. * * @since v0.2.2 */ export type Panic = (cause?: unknown) => never; /** * Throws an {@linkcode Exception} with a given `message` template with `tokens` * and additional `context` data. * * @since v0.2.0 */ export declare function throws(message: string, tokens?: ExceptionTokens, context?: ExceptionContext): never; /** * Throws a given {@linkcode Error}. * If given a callback, throws an {@linkcode Error} returned by the callback. * * @since v0.1.0 */ export declare function throws(error: Value): never; /** * Creates a function that throws an {@linkcode Exception} with a given `message` template * with `tokens` and additional `context` data. * If the `cause` is defined, sets the `cause` as a `previous` error. * * @since v0.2.0 */ export declare function panic(message: string, tokens?: ExceptionTokens, context?: ExceptionContext): Panic; /** * Creates a function that throws a given {@linkcode Error}. * Ignores the `cause`, even when if is defined. * * @since v0.1.0 */ export declare function panic(error: Value): Panic; /** * Throws an {@linkcode Exception} with a given `message` caused by a `previous` {@linkcode Error}. * Exception message may contain given `tokens` and additional `context` data. * * @throws Exception - created with given parameters. * * @since v0.2.0 */ export declare function rethrows(previous: Error, message: string, tokens?: ExceptionTokens, context?: ExceptionContext): never;