123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::ErrorReporter::ErrorContextMiddlewareStack

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activesupport/lib/active_support/error_reporter.rb

Class Method Summary

Instance Method Summary

Constructor Details

.newErrorContextMiddlewareStack

[ GitHub ]

  
# File 'activesupport/lib/active_support/error_reporter.rb', line 301

def initialize
  @stack = []
end

Instance Method Details

#execute(error, handled:, severity:, context:, source:)

Run all middlewares in the stack

[ GitHub ]

  
# File 'activesupport/lib/active_support/error_reporter.rb', line 315

def execute(error, handled:, severity:, context:, source:)
  @stack.inject(context) { |c, middleware| middleware.call(error, context: c, handled:, severity:, source:) }
end

#use(middleware)

Add a middleware to the error context stack.

[ GitHub ]

  
# File 'activesupport/lib/active_support/error_reporter.rb', line 306

def use(middleware)
  unless middleware.respond_to?(:call)
    raise ArgumentError, "Error context middleware must respond to #call"
  end

  @stack << middleware
end