Les Hill github twitter facebook linked in archives
Posted January 12, 2009

I have been using Hoptoad to track exceptions in my Rails apps for a while now. The standard setup tracks exceptions in your controllers with a simple include HoptoadNotifier::Catcher in your application.rb, easy!

However, I also wanted Hoptoad to track any exception which occurred in a cron job that was running with script/runner. Again, a snap with Hoptoad, take a look:

1 class CronJob
2   def self.process
3     # do stuff
4   rescue => ex
5     HoptoadNotifier.notify(ex)
6   end
7 end

Thanks to Tom Preston-Werner for the CSS layout, Webby for the blog renderer, and GitHub Pages for the blog hosting.