Errors
Which error you caught tells you where the problem is before you read the message.
ts
import { EvalwrightApiError, EvalwrightClientError } from "@evalwright/sdk";
try {
await client.prompts.resolve(SUPPORT_REPLY_ID, { vars });
} catch (err) {
if (err instanceof EvalwrightApiError) {
// The server answered, and the answer was a refusal.
console.error(err.status, err.code, err.message, err.details);
} else if (err instanceof EvalwrightClientError) {
// The call never left your process: the client was built wrong.
} else {
// Network, DNS, timeout, abort — the platform's own errors, unwrapped.
}
}EvalwrightApiError
| Property | Type | |
|---|---|---|
status | number | HTTP status |
code | string | Stable machine-readable code — branch on this, not on the message |
message | string | Human-readable explanation |
details | unknown | Present when the server can say more |
| Status | Code | Meaning | Retry? |
|---|---|---|---|
401 | UNAUTHORIZED | Key missing, malformed or revoked | No |
404 | NOT_FOUND | Nothing is deployed for that prompt id in the key's environment — or the prompt's name was passed where its id goes | No |
429, 5xx | — | Rate limited or upstream fault | Yes, with backoff |
404 does not separate "no such prompt" from "not deployed here": saying which would tell a caller about prompts outside the environment its key reads.
EvalwrightClientError
Raised in your process, never by the server:
- the client was constructed without an
apiKeyorbaseUrl, with a negativecache.ttlMs, or with atimeoutMsthat is not a whole number of milliseconds from 1 to 2147483647; - a
resolve()call left out a variable the prompt needs or gave one that is not a string, or the prompt holds a malformed placeholder. The message names every one.
Retrying cannot help — fix the call.