Class: Mediate::ErrorHandlerState

Inherits:
Object
  • Object
show all
Defined in:
lib/mediate/error_handler_state.rb

Overview

Represents the result of handling an exception

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/mediate/error_handler_state.rb', line 8

def result
  @result
end

Instance Method Details

#handled?Boolean

Indicates whether the current exception has been handled and the result should be returned (if applicable).

Returns:

  • (Boolean)

    whether the current exception has been handled



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

def handled?
  !!@handled
end

#set_as_handled(result = nil) ⇒ Boolean

Sets the state as handled with the given result. Subsequent error handlers will be skipped and, if

the exception was thrown while handling a Mediate::Request, this result will be returned.

Parameters:

  • result (defaults to: nil)

    if the exception was thrown as part of handling a Mediate::Request, this will be returned

Returns:

  • (Boolean)

    true



18
19
20
21
# File 'lib/mediate/error_handler_state.rb', line 18

def set_as_handled(result = nil)
  @result = result
  @handled = true
end