Skip to main content

EitherError

@ts-rust/std


@ts-rust/std / Result / EitherError

Interface: EitherError<E>

Defined in: packages/std/src/result/interface.ts:97

Base interface for CheckedError instances, providing methods to inspect and handle the contained error.

Extends​

  • Error

Type Parameters​

Type Parameter

E

Properties​

PropertyTypeInherited fromDefined in

cause?

unknown

Error.cause;

node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24

message

string

Error.message;

node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075

name

string

Error.name;

node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074

stack?

string

Error.stack;

node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Methods​

handle()​

handle<T>(f, g): T;

Defined in: packages/std/src/result/interface.ts:105

Applies one of two functions to the contained error based on its type.

Applies the first function in case the inner error is unexpected ResultError, or the second function if the inner error is expected E.

Type Parameters​

Type Parameter

T

Parameters​

ParameterType

f

(e) => T

g

(e) => T

Returns​

T


isExpected()​

isExpected(): this is ExpectedError<E>;

Defined in: packages/std/src/result/interface.ts:110

Checks if this is an expected error, narrowing to ExpectedError.

Returns​

this is ExpectedError<E>


isUnexpected()​

isUnexpected(): this is UnexpectedError<E>;

Defined in: packages/std/src/result/interface.ts:115

Checks if this is an unexpected error, narrowing to UnexpectedError.

Returns​

this is UnexpectedError<E>