Every exception extends STXException. Catch the class you care about with instanceof.
| Exception | Extends | When |
|---|---|---|
STXException |
Error |
Base for every error the SDK throws. |
STXConfigException |
STXException |
The client is misconfigured: unknown region, missing key, bad PEM. |
STXAPIException |
STXException |
The API answered with an error status. Base for the classes below. |
STXValidationException |
STXAPIException |
400: a parameter or body field was rejected, e.g. price is required. |
STXAuthenticationException |
STXAPIException |
401: the signature, key ID or timestamp was not accepted. A machine clock more than 30 seconds off also lands here. |
STXForbiddenException |
STXAPIException |
403: the key is read-only, or the account may not do this. When the server names the scopes that would satisfy the call (in the WWW-Authenticate challenge), requiredScopes lists them. |
STXNotFoundException |
STXAPIException |
404: the resource does not exist, or belongs to another account. |
STXRejectedException |
STXAPIException |
422: the exchange refused the request, e.g. insufficient funds or a closed market. |
STXGeoLocationException |
STXRejectedException |
422 from the exchange’s geo-fencing: this request’s IP address is not allowed to trade, or the geolocation packet sent with it was missing, invalid, expired or from another user. A subclass of STXRejectedException, so existing catch blocks still see it. |
STXRateLimitException |
STXAPIException |
429: too many requests. retryAfter is seconds, when sent. |
STXServerException |
STXAPIException |
5xx: the server failed. Retried by the default policy on GET and DELETE. |
STXTransportException |
STXException |
The request never got an answer: connection, DNS, TLS or timeout. |
STXChannelException |
STXException |
A channel join or channel message was refused by the server. reply holds the server’s response object, for example {reason: "unauthorized"}. |
STXTimeoutException |
STXChannelException |
No reply, message or snapshot arrived on a channel in time. A subclass of STXChannelException. |
STXException
Section titled “STXException”Base for every error the SDK throws.
| Property | Type | Description |
|---|---|---|
body |
unknown |
|
method |
string | undefined |
|
path |
string | undefined |
|
statusCode |
number | undefined |
STXConfigException
Section titled “STXConfigException”The client is misconfigured: unknown region, missing key, bad PEM.
STXAPIException
Section titled “STXAPIException”The API answered with an error status. Base for the classes below.
STXValidationException
Section titled “STXValidationException”400: a parameter or body field was rejected, e.g. price is required.
STXAuthenticationException
Section titled “STXAuthenticationException”401: the signature, key ID or timestamp was not accepted. A machine clock more than 30 seconds off also lands here.
STXForbiddenException
Section titled “STXForbiddenException”403: the key is read-only, or the account may not do this. When the server
names the scopes that would satisfy the call (in the WWW-Authenticate
challenge), requiredScopes lists them.
| Property | Type | Description |
|---|---|---|
requiredScopes |
readonly string[] |
STXNotFoundException
Section titled “STXNotFoundException”404: the resource does not exist, or belongs to another account.
STXRejectedException
Section titled “STXRejectedException”422: the exchange refused the request, e.g. insufficient funds or a closed market.
STXGeoLocationException
Section titled “STXGeoLocationException”422 from the exchange’s geo-fencing: this request’s IP address is not
allowed to trade, or the geolocation packet sent with it was missing,
invalid, expired or from another user. A subclass of
STXRejectedException, so existing catch blocks still see it.
reason classifies it; ipAddress is the address the exchange saw, when
its message names one. Never retried.
| Property | Type | Description |
|---|---|---|
ipAddress |
string | undefined |
|
reason |
"ip_not_allowed" | "packet_invalid" | "packet_other_user" | "packet_ip_mismatch" | "location_not_allowed" |
STXRateLimitException
Section titled “STXRateLimitException”429: too many requests. retryAfter is seconds, when sent.
| Property | Type | Description |
|---|---|---|
retryAfter |
number | undefined |
STXServerException
Section titled “STXServerException”5xx: the server failed. Retried by the default policy on GET and DELETE.
STXTransportException
Section titled “STXTransportException”The request never got an answer: connection, DNS, TLS or timeout.
STXChannelException
Section titled “STXChannelException”A channel join or channel message was refused by the server. reply holds
the server’s response object, for example {reason: "unauthorized"}.
| Property | Type | Description |
|---|---|---|
reply |
unknown |
|
topic |
string |
STXTimeoutException
Section titled “STXTimeoutException”No reply, message or snapshot arrived on a channel in time. A subclass of
STXChannelException.

