Skip to main content
Version: v0.0.7

Class: MllpTimeoutError

Thrown (or rejects the send() promise) when an ACK does not arrive within the configured ackTimeoutMs.

The timeout clock starts at the underlying write() flush callback, NOT at the send() call, pre-flush queue time is not charged to the peer.

Example

try {
await client.send(payload);
} catch (err) {
if (err instanceof MllpTimeoutError) {
logger.warn({ elapsedMs: err.elapsedMs, idBytes: err.messageControlIdBytes });
}
}

Extends

  • Error

Constructors

Constructor

new MllpTimeoutError(message, opts): MllpTimeoutError

Construct an MLLP timeout error.

Parameters

message

string

Human-readable error message. Structural facts only, never field content.

opts

Timeout context (control-id byte length, elapsed time, flush timestamp).

elapsedMs

number

messageControlIdBytes

number | undefined

sentAt

number

Returns

MllpTimeoutError

Overrides

Error.constructor

Properties

elapsedMs

readonly elapsedMs: number

Milliseconds elapsed between write-flush and timeout fire.


messageControlIdBytes

readonly messageControlIdBytes: number | undefined

Byte length of the timed-out send's MSH-10 control ID, or undefined when there was none to read (FIFO mode, or a payload with no MSH-10).

The control ID itself is deliberately not here. An Error is a diagnostic surface: it is logged, and its stack is what an error reporter ships off the box. MSH-10 is payload content, and a scanner that returns the wrong field returns payload content of some other kind, which is how a patient identifier reaches a log line. Nothing is lost by withholding it, because this error rejects the very send() whose payload the caller passed in, so the caller already holds the bytes. Control IDs are decoded latin1, a 1:1 byte to code-unit map, so this count is a byte count.


name

readonly name: "MllpTimeoutError"

Overrides

Error.name


sentAt

readonly sentAt: number

Epoch ms timestamp recorded at write-flush callback.