Errors

Handle LunnoaApiError status helpers in @lunnoa/client.

Failed HTTP calls throw LunnoaApiError with status helpers you can branch on.

Status helpers

PropertyMeaning
statusHTTP status code
bodyParsed error payload when available
isUnauthorized401 (missing or revoked credential)
isForbidden403 (role or licence edition does not cover the endpoint)
isRateLimited429 (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 → re-authenticate (refresh JWT or rotate the API key)
  • 403 → hide the capability; the key'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.

Next