bgreg / humanist-errors

More readable errors, for humans.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code ClimateTest CoverageBuild Status

Error messages for Humans.

Join the chat at https://gitter.im/bgreg/humanist-errors

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:

img img

Installation

Add this line to your application's Gemfile:

gem 'humanist-errors'

And then execute:

$ bundle

Or install it yourself as:

$ gem install humanist-errors

Usage

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.

  1. Add these require statements to your file:

require 'humanist_errors'

require 'humanist_errors/monkey'

  1. Include the humanist errors module:

include HumanistErrors

  1. Then your code in a human block:
	with_human_errors do
      		#....
	end

This gem is intended for use in development and test environments only.

Contributing

  1. Fork it ( https://github.com/bgreg/humanist-errors/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

More readable errors, for humans.

License:MIT License


Languages

Language:Ruby 100.0%