Sha256: 4b6a7ba4e113110c20dbc9f6e672e6378c944f3036cbe4ae884c8fe5a0253580

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

require 'rollbar'
require 'rollbar/exception_reporter'

module Rollbar
  module Middleware
    class Sinatra
      include ::Rollbar::ExceptionReporter

      def initialize(app)
        @app = app
      end

      def call(env)
        response = @app.call(env)
        report_exception_to_rollbar(env, framework_error(env)) if framework_error(env)
        response
      rescue ::Exception => exception
        report_exception_to_rollbar(env, exception)
        raise
      end

      def framework_error(env)
        env['sinatra.error']
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rollbar-1.1.0 lib/rollbar/middleware/sinatra.rb