Humanist errors is a system for extending ruby exception messages. It will prepend the standard output with text defined in the humanist errors dictionary that hopefully explains what is going on a little better.
Some examples:
Add this line to your application's Gemfile:
gem 'humanist-errors'
And then execute:
$ bundle
Or install it yourself as:
$ gem install humanist-errors
You can use humanist errors globally in your project, or only around specific pieces of code. To use globally:
Require the library and monkey file
require 'humanist_errors'
require 'humanist_errors/monkey'
Thats it! Now when ruby tries to evaluate an error like when you say: 1/0
you will see a new error message.
If you only want to see new errors in an isolated area you can include the library and execute your code inside a special code block.
- Add these require statements to your file:
require 'humanist_errors'
require 'humanist_errors/monkey'
- Include the humanist errors module:
include HumanistErrors
- Then your code in a human block:
with_human_errors do
#....
end
This gem is intended for use in development and test environments only.
- Fork it ( https://github.com/bgreg/humanist-errors/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request