Exception: Railsmith::Hooks::AroundHookNotYieldedError

Inherits:
Error
  • Object
show all
Defined in:
lib/railsmith/hooks/errors.rb

Overview

Raised when an around hook returns without ever invoking the wrapped action. This catches the common mistake of forgetting to call action.call (or whatever the block argument is named) inside an around hook body.

Instance Method Summary collapse

Constructor Details

#initialize(service:, action:, hook_name: nil) ⇒ AroundHookNotYieldedError

Returns a new instance of AroundHookNotYieldedError.



14
15
16
17
18
19
20
21
# File 'lib/railsmith/hooks/errors.rb', line 14

def initialize(service:, action:, hook_name: nil)
  label = hook_name ? "#{hook_name} " : ""
  super(
    "around hook #{label}on #{service}##{action} returned without " \
    "invoking the wrapped action. An around hook must call the " \
    "yielded action block (e.g. `action.call`)."
  )
end