Errors
Handle LunnoaApiError status helpers in @lunnoa/client.
Failed HTTP calls throw LunnoaApiError with status helpers you can branch on.
Status helpers
| Property | Meaning |
|---|---|
status | HTTP status code |
body | Parsed error payload when available |
isUnauthorized | 401 (missing or revoked credential) |
isForbidden | 403 (role or licence edition does not cover the endpoint) |
isRateLimited | 429 (back off and retry) |
Example
errors.ts
import { LunnoaApiError } from '@lunnoa/client';
try {
await lunnoa.workflows.execute(workflowId, inputs);
} catch (error) {
if (error instanceof LunnoaApiError && error.isForbidden) {
// Hide the capability or prompt for a stronger role
}
throw error;
}Practical mapping:
- 401 → with
createBrowserClient/ atokenStore, the SDK auto-refreshes once by default; otherwise callauth.refresh()or send the user through login again. - 403 → hide the capability; the user's role or the deployment's licence edition does not cover the endpoint
- 429 → back off and retry
For minting keys and RBAC, see API authentication. For login and refresh helpers, see Authentication.
Next
- Authentication: login, refresh, SSO
- TypeScript client SDK: overview and authentication
- API reference: full public operation list