Robustly

Don’t let small errors bring down the system

safely do
  # keep going if this code fails
end

Raises exceptions in development and test environments and rescues and reports exceptions elsewhere.

Also aliased as yolo.

yolo do
  # get crazy in here
end

Reports exceptions to Rollbar, Airbrake, Exceptional, Honeybadger, Sentry, Raygun, and Bugsnag out of the box thanks to Errbase.

Customize reporting with:

Robustly.report_exception_method = proc {|e| Rollbar.report_exception(e) }

And throttle reporting with:

safely throttle: 1000 do
  # reports ~ 1/1000 errors
end

Specify a default value to return on errors:

safely default: 30 do
  # big bucks, no whammy
end

Catch specific errors

safely only: ActiveRecord::RecordNotUnique do
  # all other exceptions will be raised
end

Installation

Add this line to your application’s Gemfile:

gem 'robustly'

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help: