Aller au contenu
Français

Failure

Ce contenu n’est pas encore disponible dans votre langue.

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

The computation threw.

new Failure(error): Failure

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

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:92


readonly error: unknown

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

get cause(): Error

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

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:138

Failure passes through filter unchanged.

(value) => boolean

(value) => Error

Try<never>


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

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

U

(value) => Try<U>

Try<U>


fold<U>(onFailure, _onSuccess): U

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

U

(err) => U

(value) => U

U


forEach(_f): void

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

(value) => void

void


get(): never

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

Throws the stored error (Scala parity).

never


getOrElse<U>(fallback): U

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

U

U | ((err) => U)

U


isFailure(): this is Failure

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

this is Failure


isSuccess(): this is Success<never>

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

this is Success<never>


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

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

U

(value) => U

Try<U>


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

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

U

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

Try<U>


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

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

Apply the recovery function; 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:132

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

U

(err) => Try<U>

Try<U>


toError(): Error

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

Error


toNullable(): null

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

null