UNPKG

@avonjs/avonjs

Version:

A fluent Node.js API generator.

18 lines (17 loc) 659 B
import type { AnyValue } from '../Contracts'; export default class Exception extends Error { message: string; constructor(message?: string, ...args: readonly unknown[]); /** * Throw the Exception. */ static throw(message?: string, ...args: readonly unknown[]): void; /** * Generate an Exception if the given condition is satisfied. */ static when(condition: boolean, message?: string, ...args: readonly unknown[]): void; /** * Generate an Exception if the given condition is not satisfied. */ static unless(condition: AnyValue, message?: string, ...args: readonly unknown[]): asserts condition; }