Class: AckBuildError
Thrown by build999 / buildTA1 when the caller asks the library to
fabricate an inconsistent acknowledgment (most notably an accept paired
with errors). Carries a stable code for programmatic narrowing.
Throwing here is the documented contract for the cosyte ack archetype: the library mechanically builds the disposition it is told; if the disposition is internally inconsistent it refuses, surfacing the bug at the call site rather than silently lying to the inbound sender.
AckBuildError deliberately does NOT extend X12ParseError - the
parser-vs-builder distinction matters at the type level (a parser catch
should never catch a builder bug, and vice versa).
Example
import { AckBuildError, ACK_BUILD_ERROR_CODES } from "@cosyte/x12";
try {
build999({ ... ack: { ..., functional: { disposition: "A", ... } }, ... });
} catch (err) {
if (err instanceof AckBuildError) {
// err.code is one of ACK_BUILD_ERROR_CODES
}
}
Extends
Error
Constructors
Constructor
new AckBuildError(
code,message):AckBuildError
Internal
Construct a new AckBuildError. Both fields required so every thrower
pins a stable code.
Parameters
code
message
string
Returns
AckBuildError
Overrides
Error.constructor
Properties
code
readonlycode:AckBuildErrorCode