Skip to content
Sheetwrite

@sheetwrite/core/codec

isSheetwriteErrorfunction

Report a problem

On this page

Check whether a value is a Sheetwrite error. It matches same-realm errors, cross-realm errors, and serialized failure envelopes by shape: a string name and message, a non-empty string code and operation, and a JSON-safe context when present. The guard does not check code against a list, so a code from a newer Sheetwrite still passes; handle unknown codes in the default branch of a switch.

Declaration

function isSheetwriteError(
value: unknown,

Parameters

value: unknownrequired

Anything caught or received, such as a catch binding or a parsed message from a worker.

Returns

true when value has the shape of a Sheetwrite error envelope.