Errors
The core package ships specialized error classes that extend Error and include a code to help downstream adapters react appropriately.
OrgaAIError
Base error class. All other errors extend it.
| Property | Type | Description |
|---|---|---|
message | string | Human-readable description. |
code | string | Stable error code (CONFIGURATION_ERROR, etc.). |
try {
OrgaAI.getConfig();
} catch (error) {
if (error instanceof OrgaAIError) {
console.error(error.code, error.message);
}
}ConfigurationError
Thrown when OrgaAI.init() receives invalid configuration (invalid temperature range, missing session config endpoint/fetcher).
OrgaAI.init({ temperature: 5 }); // throws ConfigurationErrorPermissionError
Use when platform adapters cannot obtain device permissions (e.g., getUserMedia rejection). The core package exports the class so adapters can standardize error handling.
throw new PermissionError('Microphone access rejected');ConnectionError
Represents failures when the adapter cannot reach Orga’s realtime services (WebRTC negotiation, signaling). Typically thrown by higher-level utilities or adapters.
SessionError
Signals issues during an active session (invalid state transitions, missing tracks). Reserved for adapter-level use but exported to keep error taxonomy consistent.