Capturing Errors on a Global Scale

Josh Clayton

Has your database gone down recently? What about timeouts from third-party services? Exceptions can be raised anywhere in your app, and Hoptoad’s here to track them for you. Problem is, these exceptions can manifest themselves in your controllers or models, and that’s not helpful when you have to sort through all of them because of Hoptoad’s grouping logic.

To help, we’ve introduced global error classes for all paid accounts. Per project, you can list exception classes that you’d like to be grouped together in Hoptoad. We handle the nitty-gritty so your life is easier when you’re trying to resolve these issues that come up. Since we’re not ones to leave you high and dry, we’ve started everyone off with a list of common global exceptions from Rails projects:

  • Mysql::Error
  • MemCache::MemCacheError
  • Mongrel::TimeoutError
  • ThinkingSphinx::ConnectionError
  • Net::HTTPFatalError
  • OpenURI::HTTPError
  • ActiveResource::ResourceNotFound
  • ActiveResource::TimeoutError
  • ActiveResource::ServerError
  • Net::SMTPServerBusy
  • Net::SMTPFatalError
  • Net::SMTPSyntaxError

To change the list of global errors, go edit a project.

Edit a project

Under the name of the project, you’ll see a list of Global Error Classes (again, prepopulated with a handful of common errors). We separated by new lines, but spaces or commas will work as well.

List of global error classes

Once those are set up, you’re ready to roll! Here’s a snapshot of how a global error shows up after adding RuntimeError to the list.

RuntimeError as a global error

That’s about all there is to it! Note that this isn’t retroactive, so your old errors will still be in the same groups as they were before. Another reminder: if you’re on our Egg plan, be sure to upgrade; your first month is free!

FYI: Hoptoad/Airbrake was sold to RackSpace and is now called Airbrake Bug Tracker.