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.
Moving to module to hijack Faraday errors
- Loading branch information
Showing
2 changed files
with
18 additions
and
7 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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
class CalaisError < StandardError | ||
attr_reader :object | ||
|
||
def initialize(object) | ||
@object = object | ||
module Errors | ||
This comment has been minimized.
Sorry, something went wrong. |
||
class RaiseError < Faraday::Response::Middleware | ||
|
||
def on_complete(env) | ||
raise Errors::NotFound if env[:status] == 404 | ||
end | ||
|
||
end | ||
|
||
end | ||
end |
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 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/test_helper') | ||
|
||
describe OpenCalais::Client do | ||
|
||
it "is initialized with defaults" do | ||
oc = OpenCalais::Client.new | ||
oc.current_options.wont_be_nil | ||
oc.current_options.must_equal OpenCalais.options | ||
end | ||
end |
Hey, so is there a reason why this is in a global
Errors
module rather than in sayOpenCalais::Errors
?