Skip to content

Failure

Defined in: src/util/Try.ts:90

The computation threw.

new Failure(error): Failure

Defined in: src/util/Try.ts:93

The raw thrown value. Usually an Error but could be anything JS allowed throwing.

unknown

Failure

readonly _tag: "Failure"

Defined in: src/util/Try.ts:91


readonly error: unknown

Defined in: src/util/Try.ts:93

get cause(): Error

Defined in: src/util/Try.ts:102

The error coerced to an Error. Kept as an alias for back-compat with code that used the previous pipeTo-style Failure (which named the field cause and typed it as Error). Prefer .error in new code — .cause lies in the sense that we don’t control the thrown value’s type, only its coercion.

Error

filter(_pred, _makeError?): Try<never>

Defined in: src/util/Try.ts:137

Failure passes through filter unchanged.

(value) => boolean

(value) => Error

Try<never>


flatMap<U>(_f): Try<U>

Defined in: src/util/Try.ts:120

U

(value) => Try<U>

Try<U>


fold<U>(onFailure, _onSuccess): U

Defined in: src/util/Try.ts:139

U

(err) => U

(value) => U

U


forEach(_f): void

Defined in: src/util/Try.ts:143

(value) => void

void


get(): never

Defined in: src/util/Try.ts:146

Throws the stored error (Scala parity).

never


getOrElse<U>(fallback): U

Defined in: src/util/Try.ts:109

U

U | ((err) => U)

U


isFailure(): this is Failure

Defined in: src/util/Try.ts:107

this is Failure


isSuccess(): this is Success<never>

Defined in: src/util/Try.ts:106

this is Success<never>


map<U>(_f): Try<U>

Defined in: src/util/Try.ts:119

U

(value) => U

Try<U>


orElse<U>(alt): Try<U>

Defined in: src/util/Try.ts:115

U

Try<U> | (() => Try<U>)

Try<U>


recover<U>(f): Try<U>

Defined in: src/util/Try.ts:123

Apply the recovery fn; returned value is wrapped in Success. null keeps the Failure.

U

(err) => U | null

Try<U>


recoverWith<U>(f): Try<U>

Defined in: src/util/Try.ts:131

Apply the recovery fn; its Try return value wholesale replaces this Failure.

U

(err) => Try<U>

Try<U>


toError(): Error

Defined in: src/util/Try.ts:153

Error


toNullable(): null

Defined in: src/util/Try.ts:151

null