Sha256: d8abde08d8ed91bc63c6665cea018d13d2c4e73aa83edef56c581ff4533fb8aa

Contents?: true

Size: 969 Bytes

Versions: 4

Compression:

Stored size: 969 Bytes

Contents

# frozen_string_literal: true

module Mnemosyne
  module Probes
    module ActionDispatch
      module ShowExceptions
        class Probe < ::Mnemosyne::Probe
          def setup
            ::ActionDispatch::ShowExceptions.prepend Instrumentation
          end

          module Instrumentation
            def render_exception(env, exception)
              if (trace = ::Mnemosyne::Instrumenter.current_trace)
                if exception.respond_to?(:unwrapped_exception) && exception.respond_to?(:exception)
                  # ActionDispatch::ExceptionWrapper
                  trace.attach_error(exception.exception)
                else
                  trace.attach_error(exception)
                end
              end

              super
            end
          end
        end
      end
    end

    register 'ActionDispatch::ShowExceptions',
      'action_dispatch/middleware/show_exceptions',
      ActionDispatch::ShowExceptions::Probe.new
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mnemosyne-ruby-2.1.2 lib/mnemosyne/probes/action_dispatch/show_exceptions.rb
mnemosyne-ruby-2.1.1 lib/mnemosyne/probes/action_dispatch/show_exceptions.rb
mnemosyne-ruby-2.0.0 lib/mnemosyne/probes/action_dispatch/show_exceptions.rb
mnemosyne-ruby-1.17.0 lib/mnemosyne/probes/action_dispatch/show_exceptions.rb