Build your own
Errors
Find out what each error means in a browser session and on your server, and what to tell the visitor.
Browser sessions report problems as a VoxioError. The server SDK throws a VoxioServerError. Both carry a code you can switch on.
Catch browser errors
Listen for error on the session:
session.on("error", (error) => { // error.code, error.message, and error.status for HTTP failures if (error.code === "mic-denied") showMicHelp();});Widgets fire the same error as a voxio-error DOM event, and React components call onError.
Browser error codes
| Code | Meaning | What to do |
|---|---|---|
mic-denied | The visitor refused microphone (or camera) access. | Ask them to allow it in the browser and start again. |
no-device | No microphone is connected, or another app is using it. | Ask them to check the device and try again. |
insecure-context | The page isn’t served over HTTPS. | Serve it over HTTPS. localhost works while you develop. |
unsupported | The browser has no WebRTC or media support. | Offer chat instead, or ask for a current browser. |
auth | The flow key was refused (HTTP 401 or 403). | Check the key in the dashboard. The SDK doesn’t retry this. |
rejected | The server refused the request for another reason (another 4xx). | Read the message and fix the request. The SDK doesn’t retry this. |
network | The voice server couldn’t be reached, or kept failing. | The SDK already retried 3 times. Ask the visitor to try again. |
connection-lost | A live call dropped and couldn’t be restored. | Start a new session. |
Catch server errors
Wrap server calls and check the code:
import { VoxioServerError } from "voxioagent/server";
try { await voxio.flows.update(flowKey, { name: "Support" });} catch (e) { if (e instanceof VoxioServerError && e.code === "not-found") { // the flow key is wrong or the flow was deleted } else { throw e; }}The error's message is the service's own, with its request id when there is one. Quote the request id if you contact support.
Server error codes
| Code | HTTP status |
|---|---|
invalid-request | 400 or 422 |
unauthorized | 401: the key was refused |
forbidden | 403 |
not-found | 404 |
rate-limited | 429 |
server-error | 5xx |
network | None: the service couldn’t be reached |
Next steps
- Headless sessions: see how reconnects and retries work.
- Server SDK: set timeouts and retries for server calls.