Skip to main content
Version: v0.0.3

Class: MllpFramingError

Thrown for unrecoverable MLLP wire-format violations.

  • code, stable WarningCode identifying the violation
  • byteOffset, absolute stream position where the violation was detected
  • snippet, the single framing-boundary byte that broke the structure, or empty when the anomaly is not a specific byte. Never a run of payload content (see the snippet PHI contract below); the constructor caps whatever it is given to 64 bytes as a backstop.

Example

// Pass only the offending framing-boundary byte, never a slice of payload content.
throw new MllpFramingError('MLLP_MISSING_LEADING_VT', byteOffset, Buffer.from([byte]));

Extends

  • Error

Constructors

Constructor

new MllpFramingError(code, byteOffset, snippet, message?): MllpFramingError

Construct an MLLP framing error.

Parameters

code

WarningCode

The stable warning code classifying the violation.

byteOffset

number

Absolute stream byte offset where the violation was detected.

snippet

Buffer

Raw bytes copied from around the anomaly (capped to 64 bytes).

message?

string

Optional human-readable override message.

Returns

MllpFramingError

Overrides

Error.constructor

Properties

byteOffset

readonly byteOffset: number

Absolute byte offset in the stream where the error was detected.


code

readonly code: WarningCode

Stable warning code identifying the violation type.


name

readonly name: "MllpFramingError"

Overrides

Error.name


snippet

readonly snippet: Buffer

Up to 64 bytes copied from around the anomaly.

This is a copied Buffer, isolated from the source buffer so it remains valid after the underlying buffer is reused or overwritten.

PHI contract: the decoder only ever populates this with the single framing-boundary byte that violated the frame structure (whose hex value the message already discloses), never a run of payload content bytes. For anomalies whose fault is not a specific byte (MLLP_FRAME_TOO_LARGE, the accumulated size), the snippet is empty: a payload slice on a public error field would leak a field-body slice of clinical content. Callers constructing this directly are responsible for the same discipline.