Docs
React SDK

RoomError

Inspect browser SDK failures and show an actionable message.

Import

React
import { RoomError, useRoom } from '@relayrtc/react'

Fields

FieldMeaning
codeTyped error category.
messageHuman-readable failure.
retryableWhether retry may be appropriate. Defaults false.
serverCodeOptional protocol failure code from the server.

Example

React
const { error, clearError } = useRoom()
 
return error ? (
  <div role="alert">
    <p>{error.message}</p>
    <button onClick={clearError}>Dismiss</button>
  </div>
) : null

Common failures

CodeWhat to check
INVALID_CONFIGURATIONSignaling URL, timeouts and callback options.
INVALID_TOKEN, TOKEN_EXPIREDParticipant token and its expiry.
PERMISSION_DENIEDToken permissions for the requested action.
MEDIA_PERMISSION_DENIEDBrowser camera/microphone access.
MEDIA_OPERATION_PENDINGWait for the current capture operation.
MEDIA_PUBLISH_FAILED, MEDIA_SUBSCRIBE_FAILEDMedia setup, server and connectivity errors.
CONNECTION_FAILEDSignaling URL, allowed origin and service availability.
RECONNECT_FAILED, ICE_RECOVERY_FAILEDRecovery deadline or transport failure.
PARTICIPANT_REMOVED, ROOM_ENDEDThe session cannot continue.
RATE_LIMITEDReduce request frequency.

Catch promises returned by media and messaging controls. Clearing the displayed error does not repair a failed connection.