lib/rollbar/plugins/goalie.rb in rollbar-3.2.0 vs lib/rollbar/plugins/goalie.rb in rollbar-3.3.0

- old
+ new

@@ -9,32 +9,43 @@ exception_data = nil begin controller = env['action_controller.instance'] request_data = begin - controller.rollbar_request_data - rescue StandardError - nil - end + controller.rollbar_request_data + rescue StandardError + nil + end person_data = begin - controller.rollbar_person_data - rescue StandardError - nil - end - exception_data = Rollbar.scope(:request => request_data, :person => person_data).error(exception, :use_exception_level_filters => true) + controller.rollbar_person_data + rescue StandardError + nil + end + exception_data = Rollbar.scope( + :request => request_data, + :person => person_data + ).error(exception, :use_exception_level_filters => true) rescue StandardError => e - Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e}" + message = "[Rollbar] Exception while reporting exception to Rollbar: #{e}" + Rollbar.log_warning(message) end # if an exception was reported, save uuid in the env # so it can be displayed to the user on the error page - if exception_data.is_a?(Hash) + case exception_data + when Hash env['rollbar.exception_uuid'] = exception_data[:uuid] - Rollbar.log_info "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}" - elsif exception_data == 'disabled' - Rollbar.log_info '[Rollbar] Exception not reported because Rollbar is disabled' - elsif exception_data == 'ignored' - Rollbar.log_info '[Rollbar] Exception not reported because it was ignored' + Rollbar.log_info( + "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}" + ) + when 'disabled' + Rollbar.log_info( + '[Rollbar] Exception not reported because Rollbar is disabled' + ) + when 'ignored' + Rollbar.log_info( + '[Rollbar] Exception not reported because it was ignored' + ) end # now continue as normal render_exception_without_rollbar(env, exception) end