Error handling
The VorimError shape, every error code the API returns, and which ones are worth a retry rather than a log line and a page to whoever is on call.
Error Handling
The SDK throws VorimError for all API errors with structured details.
import { VorimError } from '@vorim/sdk';
try {
await vorim.check('invalid_agent_id', 'agent:read');
} catch (err) {
if (err instanceof VorimError) {
console.log(err.status); // 404
console.log(err.code); // 'AGENT_NOT_FOUND'
console.log(err.message); // 'Agent not found'
console.log(err.details); // { agent_id: 'invalid_agent_id' }
}
}typescriptCommon error codes:
| Status | Code | Description |
|---|---|---|
400 | VALIDATION_ERROR | Invalid request body or parameters |
401 | UNAUTHORIZED | Missing or invalid API key |
403 | FORBIDDEN | Insufficient permissions |
404 | AGENT_NOT_FOUND | Resource not found (entity-specific: AGENT_NOT_FOUND, PERMISSION_NOT_FOUND, CONNECTION_NOT_FOUND, …) |
409 | CONFLICT | Resource already exists |
429 | RATE_LIMITED | Too many requests |
500 | INTERNAL_ERROR | Server error |
Need Help?
Book a demo for a walkthrough, or contact us for support. For enterprise needs, reach out at sales@vorim.ai.