Error handling
API and transport failures
Spot REST responses include an error array and result. The SDK rejects a response with a nonempty error array by default. Futures responses with result: 'error' also reject. Handle both with catch.
With default exception parsing, a response error includes the HTTP code, message, exchange body, headers and request context. Spot exchange errors are in body.error; Futures errors are in the Futures response body. HTTP success alone does not mean the exchange operation succeeded.
Network failures can have a different shape, and thrown values need not be Error instances. The examples log the original error so useful diagnostics are not replaced with a generic message.
Logs in deployed applications
Log the operation, status and exchange-error fields you need. Redact credentials and private account data before forwarding logs to a shared service. parseExceptions: false preserves the original transport error, which can include request configuration.
Retry decisions
Correct invalid parameters, signatures and permissions before retrying. Apply bounded backoff to transient read failures. If an order submission times out, check matching private execution events. Use REST to recover missing state only if the outcome remains unclear; do not automatically submit again. See order recovery.
WebSocket subscription failures arrive on exception. Check subscription responses for acceptance and stream messages for data.
HTTP diagnostics
If detailed HTTP traces are required, set KRAKENTRACE=true before starting the application. Trace output can include authenticated request details and private account data. Redact it before sharing, and unset the variable when troubleshooting is complete.