Creates a ITry from an operation that may succeed or fail to return a value.
// returns JSON object or throws if input is not valid JSON string
TryFactory.of(() => JSON.parse(input)).orThrow()
Type of the value produced by the operation on success.
An operation that produces a value, but may fail to do so by throwing an error.
A ITry representing the result of the operation.
Creates a ITry from a successfully produced value.
TryFactory.success("foobar").orThrow() // => "foobar"
Type of the value produced by the operation on success.
The successful result of some operation.
A ITry representing the sucessful operation.
Generated using TypeDoc
A factory for producing an ITry representing the result of some operation that may throw an error.