Variable: X12_BUILD_ERROR_CODES
constX12_BUILD_ERROR_CODES:object
Stable string codes for every X12BuildError. Locked here so
consumers can narrow on err.code exhaustively; additions-only thereafter
(renaming any code is a breaking change).
X12_BUILD_INVALID_SPEC- a spec field violated a structural constraint the builder cannot recover from (an ISA-13 / IEA-02 control number longer than the 9-char fixed width, a segment spec with no segment id, etc.).
Type Declaration
X12_BUILD_INVALID_SPEC
readonlyX12_BUILD_INVALID_SPEC:"X12_BUILD_INVALID_SPEC"="X12_BUILD_INVALID_SPEC"
Example
import { X12_BUILD_ERROR_CODES, X12BuildError } from "@cosyte/x12";
try {
buildInterchange(spec);
} catch (err) {
if (err instanceof X12BuildError && err.code === X12_BUILD_ERROR_CODES.X12_BUILD_INVALID_SPEC) {
// application bug - the envelope spec is structurally impossible
}
}