Skip to main content
Version: v0.0.4

Class: SynthError

The typed error every fatal @cosyte/synth condition throws. Carries a stable SynthFatalCode so callers branch on err.code without matching message text.

It takes no value parameter. The message is whatever SYNTH_FATAL_MESSAGES holds for the code, so no caller-supplied string can reach a diagnostic surface by any route - not message, not stack, not a field on the thrown object.

Example

import { SynthError, SYNTH_FATAL_CODES } from "@cosyte/synth";
throw new SynthError(SYNTH_FATAL_CODES.SYNTH_UNSUPPORTED_FORMAT);

Extends

  • Error

Constructors

Constructor

new SynthError(code): SynthError

Parameters

code

SynthFatalCode

The stable SynthFatalCode. The message comes from the frozen registry.

Returns

SynthError

Overrides

Error.constructor

Properties

code

readonly code: SynthFatalCode

The stable fatal code.