Class: X12ParseError
Thrown by parseX12 when the input violates one of the 4 unrecoverable
Tier-3 structural rules (missing ISA, truncated ISA, invalid ISA
delimiters, or empty input). Carries positional context plus a short
snippet of the offending input so consumers can log actionable errors.
Remarks
Snippets may contain PHI/PII when parsing real interchanges (member IDs appear in ISA-06/08 only as trading-partner IDs, not patient identity - but real claim/eligibility bodies elsewhere in the input can carry PHI). Redact at the call site if required by your compliance posture. The library does not redact snippets itself.
Example
import { parseX12, X12ParseError } from "@cosyte/x12";
try {
parseX12("");
} catch (err) {
if (err instanceof X12ParseError && err.code === "X12_EMPTY_INPUT") {
// handle empty input - err.position, err.snippet available
}
}
Extends
Error
Constructors
Constructor
new X12ParseError(
code,message,position,snippetText):X12ParseError
Internal
Construct a new X12ParseError. All four fields are required so every
thrower populates full positional context.
Parameters
code
message
string
position
snippetText
string
Returns
X12ParseError
Overrides
Error.constructor
Properties
code
readonlycode:X12FatalCode
position
readonlyposition:X12Position
snippet
readonlysnippet:string