Skip to content

Commit

Permalink
adding raise error class
Browse files Browse the repository at this point in the history
  • Loading branch information
cometman committed Sep 29, 2015
1 parent 82b771d commit e067a11
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/errors/raise_error.rb
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.

Copy link
@knowtheory

knowtheory Oct 27, 2015

Member

So, having something named Errors::RaiseError is a little confusing in terms of what it's function is (especially since it's a subclass of Faraday::Response::Middleware). This should probably be named something like OpenCalais::ErrorHandler or OpenCalais::ResponseHandler


def on_complete(env)
raise Errors::NotFound if env[:status] == 404
raise Errors::AuthError if env[:status] == 401
end

end
end

0 comments on commit e067a11

Please sign in to comment.