Skip to content

Wildberries API TypeScript SDK / NetworkError

Class: NetworkError ​

Defined in: errors/network-error.ts:33

Network error thrown for connection failures, timeouts, and server errors.

This error is thrown for:

  • Network connection failures (no internet, DNS failures)
  • Request timeouts (exceeding configured timeout)
  • 500-level server errors (500, 502, 503, 504)

The SDK's RetryHandler automatically retries network errors with exponential backoff (max 3 attempts), so transient failures are handled automatically.

Example ​

typescript
import { NetworkError } from 'daytona-wildberries-typescript-sdk';

try {
  await sdk.products.getProductList();
} catch (error) {
  if (error instanceof NetworkError) {
    if (error.isTimeout) {
      console.error('Request timed out:', error.getUserMessage());
    } else {
      console.error('Network error:', error.getUserMessage());
    }
    // The SDK already attempted 3 retries automatically
  }
}

Extends ​

Constructors ​

Constructor ​

ts
new NetworkError(
   message: string, 
   isTimeout: boolean, 
   statusCode?: number, 
   cause?: Error, 
   response?: unknown, 
   requestId?: string): NetworkError;

Defined in: errors/network-error.ts:54

Creates a network error

Parameters ​

ParameterTypeDefault valueDescription
messagestringundefinedError message describing the network failure
isTimeoutbooleanfalseWhether this error was caused by a timeout
statusCode?numberundefinedHTTP status code (0 for network failures, 5xx for server errors)
cause?ErrorundefinedOriginal error from the HTTP client
response?unknownundefinedAPI response body if available
requestId?stringundefinedCorrelation ID for debugging

Returns ​

NetworkError

Overrides ​

WBAPIError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
statusCode?readonlynumberHTTP status code if applicableWBAPIError.statusCodeerrors/base-error.ts:25
response?readonlyunknownAPI response body if availableWBAPIError.responseerrors/base-error.ts:30
requestId?readonlystringCorrelation ID for debugging and tracing requestsWBAPIError.requestIderrors/base-error.ts:35
origin?readonlystringOrigin service identifier from RFC 7807 problem+json responses. Indicates which internal Wildberries service originated the error (e.g., "s2s-api-auth-catalog").WBAPIError.originerrors/base-error.ts:43
timestamp?readonlystringISO 8601 timestamp from RFC 7807 problem+json responses. Indicates when the error occurred on the server side (e.g., "2024-09-30T06:52:38Z").WBAPIError.timestamperrors/base-error.ts:51
cause?readonlyErrorOriginal error from the HTTP client-errors/network-error.ts:37
isTimeoutreadonlybooleanTrue if the error was caused by a timeout-errors/network-error.ts:42

Methods ​

getUserMessage() ​

ts
getUserMessage(): string;

Defined in: errors/network-error.ts:73

Returns user-friendly error message with retry information and troubleshooting guidance

Returns ​

string

Error message with network-specific recovery steps

Overrides ​

WBAPIError.getUserMessage


toJSON() ​

ts
toJSON(): {
  name: string;
  message: string;
  isTimeout: boolean;
  statusCode?: number;
  response?: unknown;
  requestId?: string;
};

Defined in: errors/network-error.ts:120

Custom JSON serialization to preserve isTimeout property

Note: The cause property is not serialized as Error objects don't serialize well. Check the cause property directly if needed.

Returns ​

ts
{
  name: string;
  message: string;
  isTimeout: boolean;
  statusCode?: number;
  response?: unknown;
  requestId?: string;
}

Object representation including timeout flag and status

NameTypeDefined in
namestringerrors/network-error.ts:121
messagestringerrors/network-error.ts:122
isTimeoutbooleanerrors/network-error.ts:123
statusCode?numbererrors/network-error.ts:124
response?unknownerrors/network-error.ts:125
requestId?stringerrors/network-error.ts:126

Overrides ​

WBAPIError.toJSON

Made with ❤️ for the Wildberries developer community