GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS

Written by thoughtbot

New Hoptoad API and development error tracking

Development Error tracking

Have you ever wanted Hoptoad to tell you whether or not a development exception has occurred in production? Now it can!

When an exception occurs in the development environment and you have the Hoptoad plug-in installed some JavaScript is quietly inserted into the page. Once the page is fully loaded it will send the details to Hoptoad asking if a similar exception has occurred in the production environment. If it has, you get a message complete with an attention grabbing Atticus. If not, nothing happens.

While this feature is enabled by default, you can easily disable it by setting development_lookup to false in config/initializers/hoptoad.rb.

HoptoadNotifier.configure do |config|
  # ...
  config.development_lookup = false
end

New Notifier API

If you’re an active user of Hoptoad, you’ve probably noticed the notifier upgrade message on the site and in notification e-mails. The new notifier has been greatly refactored and has several improvements, including bug fixes and improvements for notifier plugin authors. You can learn more about the notifier plugin by checking out the documentation. However, possibly the most important change in the new notifier is that it uses Hoptoad’s new notification API. The new API should make it easier for authors to write notification plugins, as well as make it easier for us to support the API at a satisfactory level. There are a few noteworthy improvements there.

The old API was built on top of the Rails params parser, supporting four formats (URL-encoded params, JSON, YAML, and XML). Although this may seem like a good thing, it meant that we needed to deal with the performance details of decoding a wide variety of large data sets from four completely different sources. It also made the API difficult to document and test, because we had to maintain examples for each format. The new API supports one format (XML), with clear documentation and a public schema. Only supporting one format will also make it possible to more efficiently store notice data, which should allow us to provide more information longer. Finally, a well-tested, well-documented, simpler API reduces the likilihood of bugs, which ensures that notices are sent and received as expected.

If you’re a user of Hoptoad this means that you’ll need to upgrade your notifier plugin, as the old API will eventually be going away. Using the new API, we’ll be able to provide a faster, more stable way for your application to send us your errors.

If you’re a notifier author, this means you’ll be able to write your notifier using fewer lines and less confusion. If you’re interested in the Hoptoad notifier API for any reason, please drop us a line on the Hoptoad Notifier Development mailing list.