Variable: ACK_BUILD_ERROR_CODES
constACK_BUILD_ERROR_CODES:object
Stable string codes for every AckBuildError thrown by the
acknowledgment builders. Locked here so consumers can narrow on
err.code exhaustively. Additions-only thereafter; renaming any of
these codes is a breaking change.
X12_ACK_INVALID_DISPOSITION- A disposition was supplied that does not match "./codes.js".X12AckDispositionCode (or "./codes.js".Ta1AckCode forbuildTA1).X12_ACK_INVALID_SPEC- A spec field violated a structural constraint the builder cannot recover from (e.g., an ISA-13 control number longer than the spec's 9-char limit).X12_ACK_ACCEPT_WITH_ERRORS- AnAdisposition was supplied alongside non-empty per-transaction errors or a transaction-set whose own disposition is notA. Refused - accept must mean accept. UseEfor "accepted, errors noted" orRfor "rejected" instead.X12_ACK_COUNT_MISMATCH- The functional-levelnumberOfTransactionSets/numberReceived/numberAcceptedare internally inconsistent (e.g., accepted > received) or do not match the suppliedtransactionResponseslist.X12_TA1_ACCEPT_WITH_NOTE- A TA1Aack code was supplied with a note code other than000(no error). Refused for the same safety reason: an accept cannot cite a non-zero note.
Type Declaration
X12_ACK_ACCEPT_WITH_ERRORS
readonlyX12_ACK_ACCEPT_WITH_ERRORS:"X12_ACK_ACCEPT_WITH_ERRORS"="X12_ACK_ACCEPT_WITH_ERRORS"
X12_ACK_COUNT_MISMATCH
readonlyX12_ACK_COUNT_MISMATCH:"X12_ACK_COUNT_MISMATCH"="X12_ACK_COUNT_MISMATCH"
X12_ACK_INVALID_DISPOSITION
readonlyX12_ACK_INVALID_DISPOSITION:"X12_ACK_INVALID_DISPOSITION"="X12_ACK_INVALID_DISPOSITION"
X12_ACK_INVALID_SPEC
readonlyX12_ACK_INVALID_SPEC:"X12_ACK_INVALID_SPEC"="X12_ACK_INVALID_SPEC"
X12_TA1_ACCEPT_WITH_NOTE
readonlyX12_TA1_ACCEPT_WITH_NOTE:"X12_TA1_ACCEPT_WITH_NOTE"="X12_TA1_ACCEPT_WITH_NOTE"
Example
import { ACK_BUILD_ERROR_CODES, AckBuildError } from "@cosyte/x12";
try {
buildSomeAck();
} catch (err) {
if (err instanceof AckBuildError && err.code === ACK_BUILD_ERROR_CODES.X12_ACK_ACCEPT_WITH_ERRORS) {
// application bug - never silently accept with errors
}
}