For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Properties
  • Examples
  • Catch a RELAY error
RELAY

RelayError

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

REST Client

TypeScript API reference for RestClient and resource namespaces
Next
Built with

Custom error class for RELAY protocol errors. Extends JavaScript’s built-in Error class. The name property is always "RelayError".

1import { RelayError } from '@signalwire/sdk';

Properties

code
number

Numeric error code returned by the RELAY server.

message
string

Human-readable error description returned by the RELAY server.

name
string

Always "RelayError".

Examples

Catch a RELAY error

1import { RelayClient, RelayError } from '@signalwire/sdk';
2
3const client = new RelayClient({
4 project: process.env.SIGNALWIRE_PROJECT_ID!,
5 token: process.env.SIGNALWIRE_API_TOKEN!,
6 contexts: ['default'],
7});
8
9client.onCall(async (call) => {
10 try {
11 await call.connect(
12 [[{ type: 'phone', params: { to_number: '+15559876543' } }]],
13 );
14 } catch (e) {
15 if (e instanceof RelayError) {
16 console.log(`Error ${e.code}: ${e.message}`);
17 }
18 await call.hangup();
19 }
20});
21
22await client.run();