Skip to content

Instantly share code, notes, and snippets.

@joshuap
Created April 4, 2019 22:08
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 joshuap/5c0b3c6cb0bfb150cef3caf98cf9c6f6 to your computer and use it in GitHub Desktop.
Save joshuap/5c0b3c6cb0bfb150cef3caf98cf9c6f6 to your computer and use it in GitHub Desktop.
Report correct controller name and action to Honeybadger w/ custom Rails exceptions app
Honeybadger.configure do |config|
config.before_notify do |notice|
# break out of our hook if component is not our errors controller
break if notice.component != 'errors'
# correct the component and action info based on the url
params = Rails.application.routes.recognize_path(notice.url)
# => {:controller=>"page", :action=>"index"}
notice.controller = params[:controller]
notice.action = params[:action]
end
end
@joshuap
Copy link
Author

joshuap commented Apr 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment