RestError
Custom error class for REST API errors. Extends JavaScript’s built-in Error
class. Thrown when an HTTP request to the SignalWire REST API returns a non-success
status code. The name property is always "RestError".
Also exported as SignalWireRestError to match the Python SDK class name.
Properties
statusCode
HTTP status code returned by the API (e.g., 404, 422, 500).
body
Response body from the API. Parsed as JSON when the response was valid
JSON; otherwise the raw text. Matches the Python SDK’s
SignalWireRestError.body behavior.
url
The URL that was requested.
method
The HTTP method used ("GET", "POST", "PUT", "PATCH", "DELETE").
name
Always "RestError".
message
Human-readable summary: "{method} {url} returned {statusCode}: {body}".