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.
This commit is contained in:
Stan Hu 2017-07-04 14:02:01 -07:00
parent b5b4054d58
commit 73d019e11f
2 changed files with 6 additions and 0 deletions

View File

@ -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}"

View File

@ -0,0 +1,4 @@
---
title: Log rescued exceptions to Sentry
merge_request:
author: