Skip to main content

Overview

VIZOCHOK uses machine-readable error codes throughout the system. The backend sends structured error objects with a code field, and the SDK maps these codes to localized human-readable messages in the widget’s configured language (Ukrainian or English). The backend never sends user-facing text. It sends a code, and the client renders the appropriate message.

WebSocket Error Codes

These errors are sent as {"type": "error", "code": "..."} messages over the WebSocket connection.

Rate Limiting Errors

Session Errors

Input Errors

System Errors

SDK Client-Side Error Codes

These errors are generated by the widget SDK itself (not from the server) and delivered through the onError callback.

WebSocket Close Codes

When the server closes the WebSocket connection, it uses these custom close codes:

REST API Error Responses

REST API endpoints (admin panel, catalog management) return standard HTTP error responses:

Common HTTP Status Codes

Error Localization

The SDK maintains built-in translations for all server error codes:
Russian language ('ru') uses the Ukrainian translations, since the AI always responds in Ukrainian for Russian-language input.

Error Handling Best Practices

In the Widget

General Guidelines

  1. Do not suppress errors silently. At minimum, log them for debugging.
  2. Tenant limit errors are your concern. Monitor tenant_daily_token_limit and tenant_monthly_token_limit and upgrade your plan before hitting limits.
  3. The widget handles display. All error codes are rendered as user-friendly messages inside the chat panel automatically. The onError callback is for your application logic, not for displaying errors to users.
  4. Connection errors auto-recover. The SDK has built-in reconnection with exponential backoff (1s to 10s, up to 30 attempts). You do not need to implement your own reconnection logic.
  5. The retry_after field on rate_limit_exceeded tells you how many seconds to wait. The widget displays a countdown timer automatically.