Exception: Telnyx::Lib::WebSocket::WebSocketError
- Inherits:
-
Errors::Error
- Object
- StandardError
- Errors::Error
- Telnyx::Lib::WebSocket::WebSocketError
- Defined in:
- lib/telnyx/lib/websocket/websocket_error.rb
Overview
Error class for WebSocket-related errors in STT/TTS streaming.
This error is raised when WebSocket connections encounter issues, including connection failures, message parsing errors, and server-side error events.
Example usage:
ws.on(:error) do |error|
puts "WebSocket error: #{error.}"
puts "Server error: #{error.error}" if error.error
end
Instance Attribute Summary collapse
-
#cause ⇒ StandardError?
readonly
The underlying cause of this error.
-
#error ⇒ Hash?
readonly
The error data sent by the server in an error event.
Instance Method Summary collapse
-
#initialize(message, error: nil, cause: nil) ⇒ WebSocketError
constructor
private
A new instance of WebSocketError.
Constructor Details
#initialize(message, error: nil, cause: nil) ⇒ WebSocketError
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of WebSocketError.
31 32 33 34 35 |
# File 'lib/telnyx/lib/websocket/websocket_error.rb', line 31 def initialize(, error: nil, cause: nil) @error = error @cause = cause super() end |
Instance Attribute Details
#cause ⇒ StandardError? (readonly)
Returns The underlying cause of this error.
24 25 26 |
# File 'lib/telnyx/lib/websocket/websocket_error.rb', line 24 def cause @cause end |
#error ⇒ Hash? (readonly)
Returns The error data sent by the server in an error event.
21 22 23 |
# File 'lib/telnyx/lib/websocket/websocket_error.rb', line 21 def error @error end |