Skip to content

fx-flow v0.7.0 / flow / tryDo

Function: tryDo()

tryDo<A>(fn): TryDoResult<A>

Convert the result of fn to Result. Automatically catch error.

Type parameters

A

Parameters

fn

Returns

TryDoResult<A>

Example

typescript
const obj = {}
tryDo(() => obj.a.b) // get a failure Result

More examples

Source

packages/core/src/flow/tryDo.ts:25

Released under the MIT License.