Errors
minnha returns standard HTTP status codes and a JSON body following RFC 7807 (Problem Details).
Shape
json
{
"timestamp": "2026-05-26T12:34:56.789Z",
"status": 400,
"error": "Bad Request",
"message": "amount must be greater than 0.01",
"path": "/api/v1/sessions"
}HTTP status codes
| Status | Meaning | Retry? |
|---|---|---|
| 200 OK | Success | — |
| 400 | Validation error (missing/bad input) | No — fix the input |
| 401 | Missing or invalid API key | No |
| 403 | Authenticated but missing permission | No |
| 404 | Resource not found / not yours | No |
| 409 | Conflict (e.g. duplicate Idempotency-Key with different body) | No |
| 422 | Business rule rejected (e.g. refund > captured) | No |
| 429 | Rate-limited | Yes, with backoff |
| 5xx | Server error | Yes — SDKs do this automatically |
SDK error classes
ts
import {
MinnhaError, // base class
MinnhaApiError, // any non-2xx
MinnhaAuthError, // 401 / 403
MinnhaValidationError, // 400 / 422
MinnhaNetworkError, // timeout, DNS, ECONNRESET
MinnhaSignatureError, // webhook HMAC mismatch
} from "@minnha/node";
try {
await minnha.sessions.create({ amount: 0, currency: "SAR" });
} catch (err) {
if (err instanceof MinnhaValidationError) {
console.error(err.message); // "amount must be greater than 0.01"
console.error(err.requestId); // helpful for support
}
}Retry strategy
The Node SDK retries 408 / 425 / 429 / 5xx errors automatically with exponential backoff (2 attempts by default, jittered). For your own code, follow the same pattern.