Exception: Interactor::Failure
- Inherits:
-
StandardError
- Object
- StandardError
- Interactor::Failure
- Defined in:
- lib/interactor/error.rb
Overview
Internal: Error raised during Interactor::Context failure. The error stores a copy of the failed context for debugging purposes.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Internal: Gets the Interactor::Context of the Interactor::Failure instance.
Instance Method Summary collapse
-
#initialize(context = nil) ⇒ Failure
constructor
Internal: Initialize an Interactor::Failure.
Constructor Details
#initialize(context = nil) ⇒ Failure
Internal: Initialize an Interactor::Failure.
context - An Interactor::Context to be stored within the
Interactor::Failure instance. (default: nil)
Examples
Interactor::Failure.new
# => #<Interactor::Failure: Interactor::Failure>
context = Interactor::Context.new(foo: "bar")
# => #<Interactor::Context foo="bar">
Interactor::Failure.new(context)
# => #<Interactor::Failure: #<Interactor::Context foo="bar">>
raise Interactor::Failure, context
# => Interactor::Failure: #<Interactor::Context foo="bar">
26 27 28 29 |
# File 'lib/interactor/error.rb', line 26 def initialize(context = nil) @context = context super end |
Instance Attribute Details
#context ⇒ Object (readonly)
Internal: Gets the Interactor::Context of the Interactor::Failure instance.
7 8 9 |
# File 'lib/interactor/error.rb', line 7 def context @context end |