Class: X12BuildError
Thrown by "./build-interchange.js".buildInterchange when the
supplied envelope spec is structurally impossible. Carries a stable code
for programmatic narrowing. Deliberately does NOT extend X12ParseError
- the parser-vs-builder distinction matters at the type level.
Example
import { X12BuildError } from "@cosyte/x12";
try {
buildInterchange({ ...spec, interchangeControlNumber: "0123456789" });
} catch (err) {
if (err instanceof X12BuildError) {
// err.code is one of X12_BUILD_ERROR_CODES
}
}
Extends
Error
Constructors
Constructor
new X12BuildError(
code,message):X12BuildError
Internal
Parameters
code
"X12_BUILD_INVALID_SPEC"
message
string
Returns
X12BuildError
Overrides
Error.constructor
Properties
code
readonlycode:"X12_BUILD_INVALID_SPEC"