If you’re not sending your application errors to our hosted service Hoptoad, take a few minutes and try it out for free today!
The newest version of the official Hoptoad Notifier, 2.2, was released to Gemcutter today, and brings with it support for Rack, automatic notification of exceptions occurring in Rails Metal endpoints, and some Rails 1.2.6 fixes.
Rack support
From the README:
In order to use hoptoad_notifier in a non-Rails rack app, just load the hoptoad_notifier, configure your API key, and use the HoptoadNotifier::Rack middleware:
require 'rack'
require 'hoptoad_notifier'
HoptoadNotifier.configure do |config|
config.api_key = 'my_api_key'
end
app = Rack::Builder.app do
use HoptoadNotifier::Rack
run lambda { |env| raise "Rack down" }
end
This makes the notifier usable in any Rack-based application, including Merb or Sinatra. The README also includes an example for using the Rack notifier in Sinatra.
Automatic metal notification
The Hoptoad::Rails
module also uses this Rack support to provide automatic
Hoptoad notification from within your Rails
Metal
applications:
if defined?(::Rails.configuration) && ::Rails.configuration.respond_to?(:middleware)
::Rails.configuration.middleware.insert_after 'ActionController::Failsafe',
HoptoadNotifier::Rack
end
This means that any exceptions during requests handled by metal endpoints in your Rails application will automatically be sent to Hoptoad, just like requests that are handled by ActionController.
You can read about the other changes in 2.2 (including fixes for Rails 1.2.6) in the CHANGELOG.
FYI: Hoptoad/Airbrake was sold to RackSpace and is now called Airbrake Bug Tracker