Skip to main content
Version: v0.0.2

Variable: ACK_BUILD_ERROR_CODES

const ACK_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 for buildTA1).
  • 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 - An A disposition was supplied alongside non-empty per-transaction errors or a transaction-set whose own disposition is not A. Refused - accept must mean accept. Use E for "accepted, errors noted" or R for "rejected" instead.
  • X12_ACK_COUNT_MISMATCH - The functional-level numberOfTransactionSets / numberReceived / numberAccepted are internally inconsistent (e.g., accepted > received) or do not match the supplied transactionResponses list.
  • X12_TA1_ACCEPT_WITH_NOTE - A TA1 A ack code was supplied with a note code other than 000 (no error). Refused for the same safety reason: an accept cannot cite a non-zero note.

Type Declaration

X12_ACK_ACCEPT_WITH_ERRORS

readonly X12_ACK_ACCEPT_WITH_ERRORS: "X12_ACK_ACCEPT_WITH_ERRORS" = "X12_ACK_ACCEPT_WITH_ERRORS"

X12_ACK_COUNT_MISMATCH

readonly X12_ACK_COUNT_MISMATCH: "X12_ACK_COUNT_MISMATCH" = "X12_ACK_COUNT_MISMATCH"

X12_ACK_INVALID_DISPOSITION

readonly X12_ACK_INVALID_DISPOSITION: "X12_ACK_INVALID_DISPOSITION" = "X12_ACK_INVALID_DISPOSITION"

X12_ACK_INVALID_SPEC

readonly X12_ACK_INVALID_SPEC: "X12_ACK_INVALID_SPEC" = "X12_ACK_INVALID_SPEC"

X12_TA1_ACCEPT_WITH_NOTE

readonly X12_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
}
}