ErrorsGeneral
General
ERROR
An error with no code of its own and an HTTP status without a fallback code.
Typical cause
An error raised without a code of its own; the HTTP status says which kind.
Fix
Treat it by its HTTP status, and quote request_id to support.
Where it comes from
Any operation can answer it: handle it once, for every call.
Related
The envelope
{
"error": {
"code": "ERROR",
"message": "…",
"request_id": "req_01JB4Z0K3Q7V8W9X0Y1Z2A3B4C",
"doc_url": "https://developers.tracken.ee/errors/ERROR"
}
}Switch on
code, never on message, which is developer-facing English and may change. Field problems are in details, each with a JSON Pointer; the figures for your own text are in context. Quote request_id when you contact support.Handle it
tracken contacts list …
# exits 1 and prints the code, the message, each field problem and the request idimport { isApiError } from "@tracken/sdk";
try {
await tracken.contacts.list(…);
} catch (error) {
if (!isApiError(error, "ERROR")) throw error;
// Treat it by its HTTP status, and quote request_id to support.
}Install the SDK with npm i @tracken/sdk (0.2.0, MIT, beta), Node.js 22 or later.