Type Alias: AstmFrameEncodeErrorCode
AstmFrameEncodeErrorCode =
"ASTM_FRAME_EMPTY_RECORD"|"ASTM_FRAME_UNENCODABLE_CHARACTER"|"ASTM_FRAME_RESERVED_BYTE"|"ASTM_FRAME_INVALID_START_FRAME_NUMBER"
The reasons composeAstmFrames refuses rather than emitting bytes that are not the record it was handed.
ASTM_FRAME_EMPTY_RECORD: 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.ASTM_FRAME_UNENCODABLE_CHARACTER: a record given as astringholds a character aboveU+00FF, which has no single byte to stand for.ASTM_FRAME_RESERVED_BYTE: a record holds a byte this layer reads as frame structure (STX,ETBorETX). Framing has no escape mechanism, so such a byte cannot be carried inside a frame at all.ASTM_FRAME_INVALID_START_FRAME_NUMBER:options.startFrameNumberis not a whole number from0to7. A frame's number is one ASCII digit, so a value outside that range has no digit to be written as.
Example
import type { AstmFrameEncodeErrorCode } from "@cosyte/astm";
const code: AstmFrameEncodeErrorCode = "ASTM_FRAME_UNENCODABLE_CHARACTER";