Creates a Failure directly without needing to throw
Creates a Try from binary string
Creates a Try from JSON string
Creates a Try from a Promise, resolving to Success or Failure
Creates a Try from YAML string
Type guard to check if a Try is Failure
Type guard to check if a Try is Success
Combines an array of Trys into a single Try containing an array. Short-circuits on the first Failure, preserving its error.
Creates a Success directly without needing a callback
Maps an array through a function returning Try, then sequences the results. Short-circuits on the first Failure.
Creates a Try from a thunk that returns a Promise. The thunk is invoked when async() is called, so the Promise starts executing under the Try wrapper — synchronous throws from the thunk are caught the same way
Try(() => sync)catches them, and rejections are caught the same wayTry.fromPromise(promise)catches them.Prefer this over
Try.fromPromise(thunk())when you want the work to be deferred until wrapping (e.g. composing a chain of Try-returning thunks before any of them runs).