Docs
Node SDK

RelayApiError

Handle HTTP, transport, validation and cancellation failures.

Import

TypeScript
import { RelayApiError } from '@relayrtc/node'

Fields

FieldMeaning
codeAPI or SDK error code.
messageHuman-readable description.
statusHTTP status or null for local/transport errors.
requestIdServer request ID when available.
retryableWhether the failure can be transient.

Example

TypeScript
try {
  await relay.rooms.get(roomId)
} catch (error) {
  if (error instanceof RelayApiError) {
    console.error(error.code, error.status, error.requestId)
  } else {
    throw error
  }
}

SDK codes

CodeMeaning
INVALID_CONFIGURATIONInvalid URL, key format or options.
INVALID_REQUESTInvalid local parameters or body serialization.
INVALID_RESPONSENon-JSON success, unexpected shape or excessive response body.
NETWORK_ERRORRequest failed before a usable response.
REQUEST_TIMEOUTRequest deadline expired.
REQUEST_CANCELLEDCaller aborted the request.
HTTP_ERRORHTTP failure without a structured API code.

API failures keep the server's code, such as API_KEY_SCOPE_REQUIRED or RESOURCE_NOT_FOUND. retryable is a hint; it does not make a write operation safe to repeat.