ValidationError
Error thrown when resolved values fail validation constraints.
Exit code defaults to 2 (standard for CLI usage errors).
- Import:
@kjanat/dreamcli - Export kind: class
- Declared in:
src/core/errors/index.ts - Source link:
src/core/errors/index.ts:175
Signatures
ts
class ValidationError extends CLIError {}Members
Constructors
constructor
Create a validation error with exit code defaulting to 2.
ts
constructor(message: string, options: ValidationErrorOptions);Properties
name
Always 'ValidationError'. @override
ts
name: "ValidationError";code
Narrowed to validation-category codes.
ts
code: ValidationErrorCode;exitCode
Process exit code (defaults to 1).
ts
exitCode: number;suggest
One-liner actionable hint.
ts
suggest: string | undefined;details
Structured payload for machine output.
ts
details: Readonly<Record<string, unknown>> | undefined;message
ts
message: string;stack
ts
stack?: string | undefined;cause
ts
cause?: unknown;isError
Indicates whether the argument provided is a built-in Error instance or not.
ts
isError: (error: unknown) => error is Error;Methods
toJSON
Serialise to a plain object suitable for JSON output.
details is projected onto JSON-representable values: bigints become decimal digits and entries JSON cannot carry are omitted. The error object itself keeps the runtime values.
ts
toJSON(): CLIErrorJSON;