Function: toCastError()
function toCastError(error: unknown): CastError;
Defined in: packages/cast/src/errors.ts:103
Native rejections cross the bridge as plain Errors whose message carries
a [<code>] marker from the closed set above (the spec's error contract).
This is the single place that turns one into a typed CastError;
anything unmarked becomes code: 'native' with the original text in
raw — never swallowed, never guessed at.
The marker is matched anywhere in the message, not just at the start:
device truth is that a Kotlin Promise.reject(Throwable) arrives in JS as
"java.lang.IllegalStateException: [no-session] …" — the exception class
name is prepended by the bridge, and an anchored match silently
reclassified every typed rejection as native (found because a
receiver-death test surfaced a no-session that a filter should have
dropped).
Parameters
| Parameter | Type |
|---|---|
error | unknown |