Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Services And Fallbacks

Supabase can reuse the same error code string in different services. Because of that, translateErrorCode() requires a service argument.

import { translateErrorCode } from 'supabase-error-translator-js';

translateErrorCode('TenantNotFound', 'storage', 'en');
translateErrorCode('TenantNotFound', 'realtime', 'en');

Services

ServiceTypical source
authsupabase.auth.* calls
storagesupabase.storage.* calls
realtimeRealtime channel and connection status errors
databasePostgreSQL SQLSTATE and PostgREST PGRST error codes
functionsReserved for Supabase Edge Functions. Translation maps are currently empty.

Fallback Chain

Empty, whitespace-only, or missing codes are normalized to unknown_error.

For other codes, the lookup order is:

  1. Target language, selected service, selected code
  2. English, selected service, selected code
  3. Target language unknown_error
  4. English unknown_error

Unsupported service names are handled defensively at runtime and return the localized unknown-error fallback.

Unknown Codes

import { translateErrorCode } from 'supabase-error-translator-js';

const message = translateErrorCode('not_a_real_code', 'auth', 'de');

This returns the German unknown-error message if it exists, otherwise the English unknown-error message.