Exception: ActiveInteractor::Error::ContextFailure

Inherits:
StandardError
  • Object
show all
Defined in:
lib/active_interactor/error.rb

Overview

Raised when an interactor context fails.

Since:

  • 0.1.5

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context = nil) ⇒ ContextFailure

Initialize a new instance of ActiveInteractor::Error::ContextFailure

Parameters:

  • context (Class, nil) (defaults to: nil)

    an instance of context

Since:

  • 0.1.5



22
23
24
25
26
# File 'lib/active_interactor/error.rb', line 22

def initialize(context = nil)
  @context = context
  context_class_name = context&.class&.name || 'Context'
  super("#{context_class_name} failed!")
end

Instance Attribute Details

#contextContext::Base (readonly)

An instance of context used for debugging.

Returns:

Since:

  • 0.1.5



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/active_interactor/error.rb', line 15

class ContextFailure < StandardError
  attr_reader :context

  # Initialize a new instance of {ContextFailure}
  #
  # @param context [Class, nil] an instance of {Context::Base context}
  # @return [ContextFailure] a new instance of {ContextFailure}
  def initialize(context = nil)
    @context = context
    context_class_name = context&.class&.name || 'Context'
    super("#{context_class_name} failed!")
  end
end