Project

reraises

0.0
No commit activity in last 3 years
No release in over 3 years
Reraise an exception as another
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.3
>= 0
>= 0
 Project Readme

Reraises

Build Status Code Climate

It's a good idea to reraise exceptions from third-party libraries as your own so you're not leaking implementation details all over your codebase. For example, I would rather deal with my own Facebook::Page::Inaccessible exception than FbGraph::NotFound outside of my Facebook adapter.

If your adapter has lots of places that could leak exceptions, however, reraising them everywhere gets old really fast. That's where reraises comes in.

Usage

class Adapter
  extend Reraises

  reraise FbGraph::NotFound, as: Facebook::Page::Inaccessible, in: "query"

  def query
    raise FbGraph::NotFound, "This will be reraised as Facebook::Page::Inaccessible"
  end
end

Installation

Add this line to your application's Gemfile:

gem 'reraises'

And then execute:

$ bundle

Or install it yourself as:

$ gem install reraises

I love you

Johannes Gorset made this. You should tweet me if you can't get it to work. In fact, you should tweet me anyway.