Skip to main content
Version: v0.0.4

Class: TerminologyError

The engine's typed error. Carries a stable FatalCode so callers branch on err.code without string-matching the message. Thrown only for FATAL_CODES conditions.

The message is value-free: it names the structural fault (a resource path, a missing field) and never echoes input values.

Example

import { loadConceptMap, TerminologyError, FATAL_CODES } from "@cosyte/terminology";

try {
loadConceptMap({ resourceType: "Patient" });
} catch (err) {
(err as TerminologyError).code === FATAL_CODES.TERM_CONCEPTMAP_MALFORMED; // => true
}

Extends

  • Error

Constructors

Constructor

new TerminologyError(code, message): TerminologyError

Parameters

code

FatalCode

The stable FatalCode describing the fault.

message

string

A value-free structural description (path + fault; never an input value).

Returns

TerminologyError

Overrides

Error.constructor

Properties

code

readonly code: FatalCode

The stable fatal code. Branch on this, not on message.