Variable: FATAL_CODES
constFATAL_CODES:object
Stable string codes for every Tier-3 fatal the record parser may throw.
Consumers narrow on err.code to react to specific structural failures.
Renaming a code is a breaking change.
Type Declaration
ASTM_RECORD_NO_HEADER
readonlyASTM_RECORD_NO_HEADER:"ASTM_RECORD_NO_HEADER"="ASTM_RECORD_NO_HEADER"
The first record is not an H (header) record: an ASTM message must lead with H.
ASTM_RECORD_UNDECLARED_DELIMITERS
readonlyASTM_RECORD_UNDECLARED_DELIMITERS:"ASTM_RECORD_UNDECLARED_DELIMITERS"="ASTM_RECORD_UNDECLARED_DELIMITERS"
The H record is too short to declare the four delimiters (field/repeat/component/escape).
EMPTY_INPUT
readonlyEMPTY_INPUT:"EMPTY_INPUT"="EMPTY_INPUT"
Input was empty or whitespace-only: there is nothing to parse. Shared across layers.
Example
import { parseAstmRecords, FATAL_CODES, AstmParseError } from "@cosyte/astm";
try {
parseAstmRecords("");
} catch (err) {
if (err instanceof AstmParseError && err.code === FATAL_CODES.EMPTY_INPUT) {
// handle empty input
}
}