Skip to main content
Version: v0.0.4

Class: AstmParseError

Thrown by parseAstmRecords when the input violates one of the Tier-3 unrecoverable structural rules (empty input, no leading H, or an H that cannot declare its delimiters). Carries positional context so consumers can log an actionable error.

PHI: the error carries a stable code + position only, never a field value.

Example

import { parseAstmRecords, AstmParseError } from "@cosyte/astm";
try {
parseAstmRecords("P|1");
} catch (err) {
if (err instanceof AstmParseError && err.code === "ASTM_RECORD_NO_HEADER") {
// err.position is available; err carries no field value
}
}

Extends

  • Error

Constructors

Constructor

new AstmParseError(code, message, position): AstmParseError

Internal

Construct a new AstmParseError. Both fields are required so every thrower populates positional context and no PHI-bearing snippet is ever attached.

Parameters

code

FatalCode

message

string

position

AstmPosition

Returns

AstmParseError

Overrides

Error.constructor

Properties

code

readonly code: FatalCode


position

readonly position: AstmPosition