Exception: OpenAI::Errors::RealtimeProtocolError

Inherits:
WebSocketProtocolError show all
Defined in:
lib/openai/helpers/realtime/errors.rb,
sig/openai/helpers/realtime/extensions.rbs

Overview

Raised when a Realtime WebSocket message cannot be parsed as a typed event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, cause: nil) ⇒ RealtimeProtocolError

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 RealtimeProtocolError.

Parameters:

  • data: (String)
  • cause: (StandardError, nil) (defaults to: nil)


60
61
62
63
64
# File 'lib/openai/helpers/realtime/errors.rb', line 60

def initialize(data:, cause: nil)
  @data = data
  @cause = cause
  super("Invalid Realtime WebSocket event.")
end

Instance Attribute Details

#data ⇒ String (readonly)

Returns:

  • (String)


51
52
53
# File 'lib/openai/helpers/realtime/errors.rb', line 51

def data
  @data
end

Instance Method Details

#cause ⇒ StandardError?

Returns:

  • (StandardError, nil)


54
# File 'lib/openai/helpers/realtime/errors.rb', line 54

def cause = @cause.nil? ? super : @cause