Skip to main content
Version: v0.0.2

Variable: REMIT_835_BUILD_ERROR_CODES

const REMIT_835_BUILD_ERROR_CODES: object

Stable string codes for every Remit835BuildError. Locked here so consumers can narrow exhaustively on err.code; additions-only thereafter (renaming any code is a breaking change).

  • X12_835_BUILD_BALANCE_MISMATCH - a spec violated one of the three §1.10.2 balance invariants (service-line SVC-02 == SVC-03 + Σ(line CAS), claim CLP-03 == CLP-04 + Σ(claim+line CAS), or top-of-remit BPR-02 == Σ(CLP-04) − Σ(PLB)). The message names the invariant, the spec'd vs computed totals, and the delta - numeric values only, never PHI.
  • X12_835_BUILD_INVALID_SPEC - a structural precondition failed (no trace supplied, a claim with no patient-control number, etc.).

Type Declaration

X12_835_BUILD_BALANCE_MISMATCH

readonly X12_835_BUILD_BALANCE_MISMATCH: "X12_835_BUILD_BALANCE_MISMATCH" = "X12_835_BUILD_BALANCE_MISMATCH"

X12_835_BUILD_INVALID_SPEC

readonly X12_835_BUILD_INVALID_SPEC: "X12_835_BUILD_INVALID_SPEC" = "X12_835_BUILD_INVALID_SPEC"

Example

import { REMIT_835_BUILD_ERROR_CODES, Remit835BuildError, build835 } from "@cosyte/x12";
try {
build835(spec);
} catch (err) {
if (
err instanceof Remit835BuildError &&
err.code === REMIT_835_BUILD_ERROR_CODES.X12_835_BUILD_BALANCE_MISMATCH
) {
// the remit does not balance - fix the amounts, do not emit
}
}