Skip to content

Instantly share code, notes, and snippets.

@Startouf
Created April 5, 2018 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Startouf/f6b2759c9cd6fd62541b8a2a84b236cc to your computer and use it in GitHub Desktop.
Save Startouf/f6b2759c9cd6fd62541b8a2a84b236cc to your computer and use it in GitHub Desktop.
Rollbar notifier for Exception notifier
# Cf
# https://github.com/rollbar/rollbar-gem/issues/711
# https://github.com/smartinez87/exception_notification/issues/413
module ExceptionNotifier
class RollbarNotifier < ExceptionNotifier::BaseNotifier
def call(exception, options = {})
@env = options[:env]
@data = (@env && @env['exception_notifier.exception_data'] || {}).merge(options[:data] || {})
@current_user_data = (@env && @env['exception_notifier.current_user.exception_data'] || {}).merge(options[:current_user] || {})
unless @env.nil?
@kontroller = @env['action_controller.instance']
@request = ActionDispatch::Request.new(@env)
@session = @request.session
@environment = @request.filtered_env
end
if @current_user_data.present?
Rollbar.scope!(person: @current_user_data)
end
Rollbar.error(exception, user_info: @current_user_data)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment