Migrate try/catch to fault
Wrap only code that actually throws. Return Result / ResultAsync. Never throw from a Result-returning function.
Find the boundary
Only wrap 3rd-party calls, JSON.parse, fs, fetch, DB. Inner pure code stays plain.
Wrap throwers
Sync → fromThrowable / Result.fromThrowable. Does not catch rejected promises.
Existing promise → fromPromise / ResultAsync.fromPromise. Async fn (sync throw + reject) → fromAsyncThrowable / ResultAsync.fromThrowable.
Prefer shipped wrappers
Replace catch sites
ResultAsync.match / unwrapOr return Promise.
Return Result, never throw
Sequential work: safeTry
Capture once at the edge
Do not call capture() in helpers. Lower layers return new faults with tag / details / metadata / cause; the edge captures once.
Do not
_unsafeUnwrap/_unsafeUnwrapErroutside teststry { resultFn() }— Result does not throw; wrapping it hides nothinginstanceofto narrow faults — usefault.tagPromise<Result<T, Fault>>— returnResultAsync<T, Fault>- throw from a function whose return type is
Result/ResultAsync fromThrowableon an async function — usefromAsyncThrowable/fromPromise