exceptio-ruby¶ ↑
<img src=“https://secure.travis-ci.org/kickcode/exceptio-ruby.png” />
DESCRIPTION:¶ ↑
exceptio-ruby provides a Ruby client for the except.io error notification service (except.io).
FEATURES:¶ ↑
Logs exceptions (error messages and backtraces) to except.io, with automated hooks for Rails 2.3, Rails 3, and Rails 4, and a client class that can be used in other Ruby apps.
SYNOPSIS:¶ ↑
Add to your Gemfile as follows:
gem 'exceptio-ruby'
Then run “bundle install”, and once installed, you can configure your app:
ExceptIO::Client.configure "app-name", "api-key"
You can find these details in the except.io web app when you setup the application ready to receive error notifications.
For Rails 2.3, Rails 3 and Rails 4 apps, exceptions should now automatically track. They will track across all environments by default - you can filter exceptions by environment on the except.io website, or to choose only certain environments to track exceptions on, add this to your initializer:
ExceptIO::Client.configure "app-name", "api-key" if ["staging", "production"].include?(Rails.env)
If you’d like to ignore certain types of exceptions, you can add those exception types to the ignored exceptions list, or override the defaults entirely.
You can see the current defaults with:
ExceptIO::Client::DEFAULT_IGNORED_EXCEPTIONS
To add other exceptions to this list, you can add a line like this to your initializer:
ExceptIO::Client.ignored_exceptions << "IgnoredException"
To override the default list entirely, you can add a line like this:
ExceptIO::Client.ignored_exceptions = ["IgnoredException"]
If you are using something other than Rails, or have additional areas outside of the controllers that you want to track exceptions for, you can make a call to log an exception directly:
ExceptIO::Client.log @exception, "environment", params_hash, session_hash, "http://request/url"
Everything besides the exception itself is optional, with the environment defaulting to “production” if not supplied.
You can also wrap blocks of code that you want to log and handle errors for, such as trapping for exceptions within data migration loops and the like:
ExceptIO::Client.handle "environment", params_hash, session_hash, "http://request/url" do # some code that may or may not raise an exception end
If the code block raises an exception, it’ll be logged (as per your configuration), and the call will return nil.
Everything besides the block is optional, with the environment defaulting to “production” if not supplied.
REQUIREMENTS:¶ ↑
exceptio-ruby depends upon httparty.
INSTALL:¶ ↑
It’s best to add the gem to your Gemfile, but if needed you can install it manually:
gem install exceptio-ruby
CONTRIBUTORS:¶ ↑
Elliott Draper
LICENSE:¶ ↑
Copyright 2013 Elliott Draper <el@kickcode.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.