/** * @file Errors - KronkError * @module kronk/errors/KronkError */ import type { EmptyString, ExitCode, KronkErrorCause, KronkErrorId, KronkErrorInfo, KronkErrorJson } from '@flex-development/kronk'; /** * A command-line error. * * @category * errors * * @class * @extends {Error} */ declare class KronkError extends Error { /** * Additional lines to be logged with the error. * * @public * @instance * @member {string[]} additional */ additional: string[]; /** * Info about the cause of the error. * * @see {@linkcode KronkErrorCause} * * @public * @instance * @override * @member {KronkErrorCause | null | undefined} cause */ cause?: KronkErrorCause | null | undefined; /** * The suggested exit code to use with {@linkcode process.exit}. * * @public * @instance * @member {number} code */ code: number; /** * Unique id representing the error. * * @see {@linkcode KronkErrorId} * * @public * @instance * @member {KronkErrorId} id */ id: KronkErrorId; /** * Create a new kronk error. * * @see {@linkcode KronkErrorInfo} * * @param {KronkErrorInfo | string} info * Info about the error or a human-readable description of the error */ constructor(info: KronkErrorInfo | string); /** * Create a new kronk error. * * @see {@linkcode EmptyString} * @see {@linkcode ExitCode} * @see {@linkcode KronkErrorId} * * @param {string} reason * Human-readable description of the error * @param {EmptyString | KronkErrorId | null | undefined} [id] * Unique id representing the error * @param {ExitCode | null | undefined} [code] * Suggested exit code to use with {@linkcode process.exit} */ constructor(reason: string, id?: EmptyString | KronkErrorId | null | undefined, code?: ExitCode | null | undefined); /** * Get the error as a JSON object. * * @see {@linkcode KronkErrorJson} * * @public * @instance * * @return {KronkErrorJson} * JSON representation of `this` error */ toJSON(): KronkErrorJson; /** * Get the error as a human-readable string. * * @public * @instance * @override * * @return {string} * String representation of `this` error */ toString(): string; } export default KronkError;