forked from PRX/open_calais
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Errors | ||
class RaiseError < Faraday::Response::Middleware | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
def on_complete(env) | ||
raise Errors::NotFound if env[:status] == 404 | ||
raise Errors::AuthError if env[:status] == 401 | ||
end | ||
|
||
end | ||
end |
So, having something named
Errors::RaiseError
is a little confusing in terms of what it's function is (especially since it's a subclass ofFaraday::Response::Middleware
). This should probably be named something likeOpenCalais::ErrorHandler
orOpenCalais::ResponseHandler