Skip to content

@lelantos-org/sdk / index / NetworkError

Class: NetworkError<C> ​

Defined in: @lelantos-org/sdk/dist/errors/network.d.ts:12

HTTP failure after retries, or deadline expired. cause carries the underlying network error.

Generic in its code so AnyWalletError can list one variant per code. The parameter defaults to the full union, so NetworkError still names the class in an annotation.

Extends ​

Type Parameters ​

Type ParameterDefault type
C extends NetworkErrorCodeNetworkErrorCode

Constructors ​

Constructor ​

ts
new NetworkError<C>(
   code, 
   url, 
   message, 
   opts?
): NetworkError<C>;

Defined in: @lelantos-org/sdk/dist/errors/network.d.ts:29

Parameters ​

ParameterType
codeC
urlstring
messagestring
opts?WalletErrorOptions & object

Returns ​

NetworkError<C>

Overrides ​

WalletError.constructor

Properties ​

attempts ​

ts
readonly attempts: readonly NetworkAttempt[];

Defined in: @lelantos-org/sdk/dist/errors/network.d.ts:28

Every attempt of the logical request, oldest first; the last entry is the one status and body describe. A single entry when the request was not retried.

An entry without status received no response, so for a non-idempotent request (a submit) the server may have acted on it even though a later attempt was answered.


body? ​

ts
readonly optional body?: string;

Defined in: @lelantos-org/sdk/dist/errors/network.d.ts:20

Response body of the final attempt, when it got a non-ok response.


cause? ​

ts
optional cause?: unknown;

Defined in: typescript/lib/lib.es2022.error.d.ts:26

Inherited from ​

WalletError.cause


code ​

ts
readonly code: C;

Defined in: @lelantos-org/sdk/dist/errors/base.d.ts:39

Inherited from ​

WalletError.code


context ​

ts
readonly context: ErrorContext;

Defined in: @lelantos-org/sdk/dist/errors/base.d.ts:46

Inherited from ​

WalletError.context


details? ​

ts
readonly optional details?: Readonly<Record<string, string | number | boolean>>;

Defined in: @lelantos-org/sdk/dist/errors/base.d.ts:48

Extra diagnostic scalars for this failure, when any.

Inherited from ​

WalletError.details


message ​

ts
message: string;

Defined in: typescript/lib/lib.es5.d.ts:1077

Inherited from ​

WalletError.message


name ​

ts
name: string;

Defined in: typescript/lib/lib.es5.d.ts:1076

Inherited from ​

WalletError.name


retryable ​

ts
readonly retryable: boolean;

Defined in: @lelantos-org/sdk/dist/errors/base.d.ts:45

Whether the same call, unchanged, may succeed later without user action: a timeout, a 5xx, notes held by an earlier spend. false means retrying as-is will fail the same way.

Inherited from ​

WalletError.retryable


stack? ​

ts
optional stack?: string;

Defined in: typescript/lib/lib.es5.d.ts:1078

Inherited from ​

WalletError.stack


status? ​

ts
readonly optional status?: number;

Defined in: @lelantos-org/sdk/dist/errors/network.d.ts:18

HTTP status of the final attempt; absent when that attempt got no response (a timeout or dropped connection). Never copied from an earlier attempt: see NetworkError.attempts.


url ​

ts
readonly url: string;

Defined in: @lelantos-org/sdk/dist/errors/network.d.ts:13

Methods ​

withContext() ​

ts
withContext(extra): this;

Defined in: @lelantos-org/sdk/dist/errors/base.d.ts:53

Merge additional context in place and return this for rethrowing.

Parameters ​

ParameterType
extraErrorContext

Returns ​

this

Inherited from ​

WalletError.withContext