Skip to main content
Version: v0.0.3

Variable: FATAL_CODES

const FATAL_CODES: object

Stable string codes for every Tier-3 fatal the parser may throw. Locked at four codes: anything else MUST be a Tier-2 warning. Consumers narrow on err.code to react to specific structural failures.

Type Declaration

EMPTY_INPUT

readonly EMPTY_INPUT: "EMPTY_INPUT" = "EMPTY_INPUT"

INVALID_ENCODING_CHARACTERS

readonly INVALID_ENCODING_CHARACTERS: "INVALID_ENCODING_CHARACTERS" = "INVALID_ENCODING_CHARACTERS"

MSH_TOO_SHORT

readonly MSH_TOO_SHORT: "MSH_TOO_SHORT" = "MSH_TOO_SHORT"

NO_MSH_SEGMENT

readonly NO_MSH_SEGMENT: "NO_MSH_SEGMENT" = "NO_MSH_SEGMENT"

Example

import { parseHL7, FATAL_CODES, Hl7ParseError } from "@cosyte/hl7";
try {
parseHL7("");
} catch (err) {
if (err instanceof Hl7ParseError && err.code === FATAL_CODES.EMPTY_INPUT) {
// handle empty input
}
}