Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'on_error' callbacks, to eventually replace 'before_notify_callbacks' #608

Merged
merged 2 commits into from
Jul 22, 2020

Commits on Jul 20, 2020

  1. Add 'on_error' callbacks, backed by middleware

    These new 'on_error' callbacks will ultimately be a replacement for
    the existing 'before_notify_callbacks'
    
    The main problem these solve is that they are global, rather than
    being scoped to the current thread. This means you can add a callback
    in a Rails initializer and it will run as expected. With the current
    'before_notify_callbacks', they only run in the same thread as they
    are added and so won't run if created in an initializer. This is a
    problem in most (all ?) frameworks, not just Rails
    
    This adds some complexity to the MiddlewareStack, because it now has
    to handle procs being passed as middleware. It's important that we
    don't wrap the procs earlier for two reasons:
    
      1. We need to be able to remove them, which is much simpler if
         we can do this by object identity (because the current method
           works that way)
      2. We need to be able to abort the 'queue' of callbacks, if one
         returns false. This is much easier if we have a list of procs
         to run
    imjoehaines committed Jul 20, 2020
    Configuration menu
    Copy the full SHA
    acf4f26 View commit details
    Browse the repository at this point in the history
  2. Add changelog entry

    imjoehaines committed Jul 20, 2020
    Configuration menu
    Copy the full SHA
    25cd43c View commit details
    Browse the repository at this point in the history