Error instances. This page is a recipe collection: pattern-match with instanceof to handle a specific failure mode, retry the ones that are safe to retry, and surface the rest. By the end you will have a catch block for every error class both SDKs can produce.
Recipe: catching errors from @gavai/sdk
The high-level client throws GavaiError for API-level failures and GavaiNetworkError for transport failures (DNS, connection refused, timeout). GavaiNetworkError does not extend GavaiError — check for it separately.
GavaiError carries:
Common code values you’ll see in production:
catch-public.ts
Recipe: catching errors from @gavai/sdk-typescript
The low-level client uses a five-class hierarchy. Every class extends GavaiError.
catch-admin.ts
Recipe: retry safely
Recipe: log without leaking secrets
When you log an error, include at minimum: Do not log the full request headers or theAuthorization header — they contain your API key. If you log e.details, scan it first for fields that might echo caller-supplied secrets.