Relay

RelayError

View as MarkdownOpen in Claude

Exception raised when the Relay server returns an error response. Inherits from Python’s built-in Exception. The string representation follows the format "RELAY error {code}: {message}".

from signalwire.relay.client import RelayError

Properties

code
int

Numeric error code returned by the Relay server.

message
str

Human-readable error description returned by the Relay server.

Examples

Catch a Relay error

from signalwire.relay import RelayClient
from signalwire.relay.client import RelayError
client = RelayClient(
project="your-project-id",
token="your-api-token",
contexts=["default"],
)
@client.on_call
async def handle_call(call):
try:
await call.connect(devices=[[{"type": "phone", "params": {"to_number": "+15559876543"}}]])
except RelayError as e:
print(f"Error {e.code}: {e.message}")
await call.hangup()
client.run()