0.0
No commit activity in last 3 years
No release in over 3 years
This gem makes simpler to manage, raise and catching standard HTTP errors.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

~> 1.6
>= 0
 Project Readme

HttpErrors

This is helpful gem for easily managing, raising and catching basic HTTP errors.

Installation

Add this line to your application's Gemfile:

gem 'http_errors'

And then execute:

$ bundle

Or install it yourself as:

$ gem install http_errors

Usage

You can use in your controller:

rescue_from HTTPError do |exception|
  head exception.class.head
end

and use it anywhere as:

raise HTTPErrors::Unauthorized unless …

Available errors ErrorName(error_code, error_status):

Unauthorized	(401, :unauthorized)
Forbidden		(403, :forbidden)
NotFound		(404, :not_found)
NotAcceptable	(406, :not_acceptable)

Contributing

  1. Fork it (https://github.com/KamilLelonek/http_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