Sha256: 22c0c78d6ea0aadeb750342112b3e1017356132f71b349b68769e3adc52d14b1

Contents?: true

Size: 545 Bytes

Versions: 4

Compression:

Stored size: 545 Bytes

Contents

module Chillout
  module Middleware
    class ExceptionMonitor
      def initialize(app, client)
        @app    = app
        @client = client
      end

      def call(env)
        begin
          response = @app.call(env)
        rescue Exception => exception
          @client.dispatch_error(Chillout::Error.new(exception, env))
          raise exception
        end

        if env['rack.exception']
          @client.dispatch_error(Chillout::Error.new(env['rack.exception'], env))
        end

        response
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chillout-0.2.3 lib/chillout/middleware/exception_monitor.rb
chillout-0.2.2 lib/chillout/middleware/exception_monitor.rb
chillout-0.2.1 lib/chillout/middleware/exception_monitor.rb
chillout-0.2.0 lib/chillout/middleware/exception_monitor.rb