Sha256: de4100699db2a332e4dc341f30b14d41d52d9969d344f2540b4d3c7e37ee276d
Contents?: true
Size: 1.11 KB
Versions: 43
Compression:
Stored size: 1.11 KB
Contents
require 'rollbar/exception_reporter' require 'rollbar/request_data_extractor' module Rollbar module Middleware class Rack module Builder include ExceptionReporter include RequestDataExtractor def call_with_rollbar(env) Rollbar.reset_notifier! Rollbar.scoped(fetch_scope(env)) do begin call_without_rollbar(env) rescue ::Exception => exception report_exception_to_rollbar(env, exception) raise end end end def fetch_scope(env) { :request => proc { extract_request_data_from_rack(env) }, :person => person_data_proc(env) } rescue Exception => e report_exception_to_rollbar(env, e) raise end def person_data_proc(env) proc { extract_person_data_from_controller(env) } end def self.included(base) base.send(:alias_method, :call_without_rollbar, :call) base.send(:alias_method, :call, :call_with_rollbar) end end end end end
Version data entries
43 entries across 43 versions & 1 rubygems