Exception: EventState::ProtocolError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/event_state.rb

Overview

Base class for SendProtocolError and RecvProtocolError.

You can catch these errors by registering a block with EventMachine.error_handler.

Direct Known Subclasses

RecvProtocolError, SendProtocolError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine, state_name, action, message_name, data) ⇒ ProtocolError

Returns a new instance of ProtocolError.



20
21
22
23
# File 'lib/event_state.rb', line 20

def initialize machine, state_name, action, message_name, data
  @machine, @state_name, @action, @message_name, @data =
    machine, state_name, action, message_name, data
end

Instance Attribute Details

#action:recv, :send (readonly)

Returns whether the error occurred on a send or a receive.

Returns:

  • (:recv, :send)

    whether the error occurred on a send or a receive



38
39
40
# File 'lib/event_state.rb', line 38

def action
  @action
end

#dataObject (readonly)

Returns the message / data sent or received.

Returns:

  • (Object)

    the message / data sent or received



48
49
50
# File 'lib/event_state.rb', line 48

def data
  @data
end

#machineMachine (readonly)

Returns the machine that raised the error.

Returns:

  • (Machine)

    the machine that raised the error



28
29
30
# File 'lib/event_state.rb', line 28

def machine
  @machine
end

#message_nameObject (readonly)

Returns the name of the message sent or received.

Returns:

  • (Object)

    the name of the message sent or received



43
44
45
# File 'lib/event_state.rb', line 43

def message_name
  @message_name
end

#state_nameSymbol (readonly)

Returns the name of the state in which the error occurred.

Returns:

  • (Symbol)

    the name of the state in which the error occurred



33
34
35
# File 'lib/event_state.rb', line 33

def state_name
  @state_name
end

Instance Method Details

#inspectString

Returns:

  • (String)


53
54
55
56
# File 'lib/event_state.rb', line 53

def inspect
  "#<#{self.class}: for #{machine.class} in"\
    " #{state_name.inspect} state: #{action} #{message_name}>"
end