Class: AgUiProtocol::Core::Events::RunErrorEvent

Inherits:
BaseEvent show all
Defined in:
lib/ag_ui_protocol/core/events.rb

Overview

Signals an error during an agent run.

“‘ruby

event = AgUiProtocol::Core::Events::RunErrorEvent.new(message: “An error occurred”, code: “RUN_ERROR”)

“‘

Instance Attribute Summary collapse

Attributes inherited from BaseEvent

#raw_event, #timestamp, #type

Instance Method Summary collapse

Methods inherited from Types::Model

#as_json, #to_json

Constructor Details

#initialize(message:, code: nil, timestamp: nil, raw_event: nil) ⇒ RunErrorEvent

Returns a new instance of RunErrorEvent.



955
956
957
958
959
# File 'lib/ag_ui_protocol/core/events.rb', line 955

def initialize(message:, code: nil, timestamp: nil, raw_event: nil)
  super(type: EventType::RUN_ERROR, timestamp: timestamp, raw_event: raw_event)
  @message = message
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



948
949
950
# File 'lib/ag_ui_protocol/core/events.rb', line 948

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



945
946
947
# File 'lib/ag_ui_protocol/core/events.rb', line 945

def message
  @message
end

Instance Method Details

#to_hObject



962
963
964
# File 'lib/ag_ui_protocol/core/events.rb', line 962

def to_h
  super.merge(message: @message, code: @code)
end