Skip to content
  • Edouard CHIN's avatar
    0cdeee42
    Fix AJ wrong deprecation message on `after_callbacks_if_terminated`: · 0cdeee42
    Edouard CHIN authored
    - ### Problem
    
      In some cirumstances, the deprecation message to warn that AJ won't
      run `after_(enqueue/perform)` callbacks when the chain is halted
      by a `throw(:abort)` will be thrown even though no `throw(:abort)`
      was thrown.
    
      ```ruby
        run_callback(:foo) do
          ...
        end
      ```
    
      There is two possible way for the callback body to not be executed:
    
      1) `before` callback throw a `abort`
      2) `before` callback raises an error which is rescued by an
         around callback (See associated test in this commit for
         an example)
    
      When 2) happen we don't want to output a deprecation message,
      because what the message says isn't true and doesn't apply.
    
      ### Solution
    
      In order to differentiate between 1) and 2), I have added
      a `halted_callback_hook` which is called by ActiveSupport callback
      whenever the callback chain is halted.
    0cdeee42
    Fix AJ wrong deprecation message on `after_callbacks_if_terminated`:
    Edouard CHIN authored
    - ### Problem
    
      In some cirumstances, the deprecation message to warn that AJ won't
      run `after_(enqueue/perform)` callbacks when the chain is halted
      by a `throw(:abort)` will be thrown even though no `throw(:abort)`
      was thrown.
    
      ```ruby
        run_callback(:foo) do
          ...
        end
      ```
    
      There is two possible way for the callback body to not be executed:
    
      1) `before` callback throw a `abort`
      2) `before` callback raises an error which is rescued by an
         around callback (See associated test in this commit for
         an example)
    
      When 2) happen we don't want to output a deprecation message,
      because what the message says isn't true and doesn't apply.
    
      ### Solution
    
      In order to differentiate between 1) and 2), I have added
      a `halted_callback_hook` which is called by ActiveSupport callback
      whenever the callback chain is halted.
Loading