Skip to main content
Version: v0.0.2

Class: CliError

A typed, PHI-safe CLI error. Its CliError.message | message is value-free by construction: callers must build it from codes, indices, offsets, format names, and file paths, never from an input value. It carries the ExitCode the invocation resolves to.

Example

import { CliError, CLI_CODES, EXIT } from "@cosyte/cli";

throw new CliError(CLI_CODES.CLI_NO_INPUT, EXIT.NOINPUT, "cannot read the named file");

Extends

  • Error

Constructors

Constructor

new CliError(code, exit, message): CliError

Parameters

code

CliCode

A stable CliCode.

exit

ExitCode

The ExitCode to resolve to.

message

string

A value-free explanation (positional/structural context only, never PHI).

Returns

CliError

Overrides

Error.constructor

Properties

code

readonly code: CliCode

The stable diagnostic code.


exit

readonly exit: ExitCode

The exit code this error resolves the invocation to.