Errors

Exception hierarchy and how to handle each kind.

Every SDK error extends NevoError. Narrow with instanceof.

import {
  NevoError,
  AuthError,
  RequestError,
  ServerError,
  NetworkError,
  UnsupportedChannelError,
  ReplyError,
} from "nevo-sdk";

Hierarchy

NevoError
├── AuthError                 — invalid / revoked API key; don't retry
├── RequestError              — client-side validation or server 4xx
├── ServerError               — server 5xx after internal retries
├── NetworkError              — transport failure after internal retries
├── UnsupportedChannelError   — the channel type doesn't accept this op
└── ReplyError                — superclass for reply-specific failures

Every concrete error exposes:

  • .message — human-readable.
  • .code — short machine-readable tag (e.g. "quota_exceeded", "bad_signature").
  • .statusCode — HTTP status, when applicable.
  • .isTransient — boolean; true for 5xx + network, false otherwise.

Usage

try {
  await client.reply(event, { text: "hi" });
} catch (err) {
  if (err instanceof AuthError) {
    // credentials wrong — don't retry, alert
    throw err;
  }
  if (err instanceof NevoError && err.isTransient) {
    // transient — the SDK already retried; your code can requeue
  } else {
    throw err;
  }
}

Stream errors

client.run() surfaces a NetworkError only if reconnection attempts exceed the configured retry budget (reconnectMaxAttempts, default unlimited). During transient blips, the SDK reconnects silently — no error is thrown at the application layer.

AuthError from the stream is terminal: if the API key is revoked mid-run, client.run() rejects with AuthError and stops reconnecting.