Skip to main content
Version: v0.0.3

Function: resolveNackCode()

resolveNackCode(err): NegativeAckCode

Resolve the negative acknowledgement code for a handler failure.

An MllpAckError carries an explicit ackCode; any other thrown value maps to AE (application error, the default, since most handler failures are transient and a resend may succeed).

Parameters

err

unknown

Returns

NegativeAckCode

Example

import { resolveNackCode, MllpAckError } from '@cosyte/mllp';
resolveNackCode(new Error('boom')); // 'AE'
resolveNackCode(new MllpAckError('nope', { ackCode: 'AR' })); // 'AR'