Skip to main content
Version: v0.0.6

Class: AstmFrameEncodeError

Thrown by composeAstmFrames when the input cannot be framed into a spec-clean stream: an empty record list, or a record with no bytes (a frame must carry a record; an empty one is a structural error, never an empty frame). Carries a stable code + the offending record index, never record bytes.

Example

import { composeAstmFrames, AstmFrameEncodeError } from "@cosyte/astm";
try {
composeAstmFrames([]);
} catch (err) {
if (err instanceof AstmFrameEncodeError) err.code; // "ASTM_FRAME_EMPTY_RECORD"
}

Extends

  • Error

Constructors

Constructor

new AstmFrameEncodeError(message, recordIndex?): AstmFrameEncodeError

Internal

Parameters

message

string

recordIndex?

number

Returns

AstmFrameEncodeError

Overrides

Error.constructor

Properties

code

readonly code: "ASTM_FRAME_EMPTY_RECORD"

Stable discriminant.


recordIndex?

readonly optional recordIndex?: number

Index of the offending record within the input, when applicable.