Skip to main content
Version: v0.0.6

Class: DeidError

The error thrown on a FATAL_CODES condition. Carries a stable code; its message is safe to log - it never contains PHI (no value, no key, no offset).

Example

import { deidentify, DeidError, FATAL_CODES } from "@cosyte/deid";

try {
deidentify(null as never, {});
} catch (err) {
if (err instanceof DeidError && err.code === FATAL_CODES.EMPTY_INPUT) {
// handle empty input
}
}

Extends

  • Error

Constructors

Constructor

new DeidError(code, message): DeidError

Parameters

code

FatalCode

The FatalCode classifying this fatal.

message

string

A PHI-free explanation safe to log.

Returns

DeidError

Overrides

Error.constructor

Properties

code

readonly code: FatalCode

The stable fatal code.