fromJSON(json: SerializedFailure): Any
Revives a SerializedFailure into a real Failure, reconstructing the cause chain.
The revived failure's stack is the remote stack — it names frames in the process that
produced the failure, not this one. That is a feature over a WebSocket boundary (it points
at the browser code that actually broke) and a trap if you forget it, so the docs call it
out explicitly.
import * as Failure from './failure.ts'; const GitScanFailed = Failure.define('GitScanFailed', (d: { ref: string }) => `bad ref: ${d.ref}`); const frame = JSON.stringify({ error: Failure.toJSON(GitScanFailed({ ref: 'HEAD' })) }); const { error } = JSON.parse(frame); const failure = Failure.fromJSON(error); // a real Failure again GitScanFailed.is(failure); // factory guards work on revived failures too — true
json: SerializedFailure