'Report errors manually from Rails to Sentry
In my ApiController I have:
rescue_from Exception, with: :render_exception_error
def render_exception_error(exception)
raise exception if Rails.env.test?
logger.error(exception)
render json: { error: 'An error occurred' }, status: 500 unless performed?
end
I want that method to also report the error to Sentry.
Do you know if by doing the line that does logger.error(...) it automatically logs it in Sentry too?
Or do I have to manually do Raven.capture_exception(exception) or something like that? Will this be done in the background?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
