Error Handling
Common error codes and how to handle them when using the NoLimitNodes API.
Classify errors by protocol before choosing a retry.
HTTP and JSON-RPC
async function rpc(method, params = []) { const response = await fetch("https://rpc.nln.clr3.org", { method: "POST", headers: { "content-type": "application/json", "x-api-key": process.env.NLN_API_KEY, }, body: JSON.stringify({ jsonrpc: "2.0", id: crypto.randomUUID(), method, params, }), }) const body = await response.json() if (!response.ok || body.error) { throw new Error(body.error?.message ?? `HTTP ${response.status}`) } return body.result}WebSocket
Treat an upgrade failure as an authentication or network error.
After a connected socket closes:
- Record the close code.
- Reconnect with backoff and jitter.
- Send every subscription again.
- Replace old subscription IDs.
- Read missed state through RPC.
gRPC
Retry rules
- Add random jitter.
- Cap total attempts.
- Set deadlines.
- Do not retry permanent client errors.
- Keep transaction retries idempotent.
- Never log API keys.