Docsvoxioagent 2.0.0

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

CodeMeaningWhat to do
mic-deniedThe visitor refused microphone (or camera) access.Ask them to allow it in the browser and start again.
no-deviceNo microphone is connected, or another app is using it.Ask them to check the device and try again.
insecure-contextThe page isn’t served over HTTPS.Serve it over HTTPS. localhost works while you develop.
unsupportedThe browser has no WebRTC or media support.Offer chat instead, or ask for a current browser.
authThe flow key was refused (HTTP 401 or 403).Check the key in the dashboard. The SDK doesn’t retry this.
rejectedThe server refused the request for another reason (another 4xx).Read the message and fix the request. The SDK doesn’t retry this.
networkThe voice server couldn’t be reached, or kept failing.The SDK already retried 3 times. Ask the visitor to try again.
connection-lostA 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

CodeHTTP status
invalid-request400 or 422
unauthorized401: the key was refused
forbidden403
not-found404
rate-limited429
server-error5xx
networkNone: the service couldn’t be reached

Next steps