From 73d019e11f163104010511ff04893194be6d2ebc Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 4 Jul 2017 14:02:01 -0700 Subject: [PATCH] Log rescued exceptions to Sentry Support noticed that a number of exceptions, such as "Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT)", failed to report to Sentry. The `rescue_from` in the ApplicationController prevented these exceptions from being recorded. This change ensures that these exceptions are properly captured. --- app/controllers/application_controller.rb | 2 ++ .../sh-log-application-controller-exceptions-sentry.yml | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 changelogs/unreleased/sh-log-application-controller-exceptions-sentry.yml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 824ce845706..b4c0cd0487f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -110,6 +110,8 @@ class ApplicationController < ActionController::Base end def log_exception(exception) + Raven.capture_exception(exception) if sentry_enabled? + application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace application_trace.map!{ |t| " #{t}\n" } logger.error "\n#{exception.class.name} (#{exception.message}):\n#{application_trace.join}" diff --git a/changelogs/unreleased/sh-log-application-controller-exceptions-sentry.yml b/changelogs/unreleased/sh-log-application-controller-exceptions-sentry.yml new file mode 100644 index 00000000000..ec9ceab3d81 --- /dev/null +++ b/changelogs/unreleased/sh-log-application-controller-exceptions-sentry.yml @@ -0,0 +1,4 @@ +--- +title: Log rescued exceptions to Sentry +merge_request: +author: