mapWireSerializationError<
Code,T>(codes,makeError,detail,write):T
Defined in: packages/wire/src/serialization-errors.ts:37
Run one write, translating every knotkit/wire caller-contract failure into
the package’s own error and code.
Wire rejects a caller contract for four reasons a structure package must
restate in its own closed list: an argument out of range (INVALID_ARGUMENT),
an unpaired surrogate with no strict UTF-8 encoding (INVALID_STRING), a
codec returning malformed bytes (INVALID_CODEC_RESULT), and a codec mapping
two distinct values to identical bytes (NON_INJECTIVE_CODEC). Without this
mapping, a caller catching the package’s InvalidInputError would see a bare
WireInvalidInputError escape instead, which breaks the package’s promise
that every throw carries a code from its own list.
Type Parameters
Section titled “Type Parameters”Code extends string
T
Parameters
Section titled “Parameters”WireSerializationCodeMap<Code>
The package’s translation of each wire code.
makeError
Section titled “makeError”(code, detail) => KnotkitError
Builds the package’s error from a translated code.
detail
Section titled “detail”string
The operation named in the message, such as heap artifact.
() => T
The write to run.
Returns
Section titled “Returns”T
Throws
Section titled “Throws”The package error selected by codes for a wire
caller-contract failure; any other error is rethrown untouched.