Skip to content

Commit

Permalink
fix rescuing LoadError rather than HttpError.
Browse files Browse the repository at this point in the history
This changes what errors are raised.  If brewerydb returns any status value that is not a 200
then an HttpError is raised, this should be handled by the application that is using tankard.

Load error can be thrown if MultiJson runs into parsing issues with the data returned.
  • Loading branch information
matthewshafer committed May 1, 2013
1 parent 7abce58 commit 174c2c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/tankard/api/beer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def find_on_single_page(block)
def request_data_with_nil_on_error(uri, options)
begin
@request.get(uri, options)["data"]
rescue Tankard::Error::HttpError
rescue Tankard::Error::LoadError
nil
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tankard/api/beers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def request_data_with_nil_on_error(uri, options)
def request_with_nil_on_error(uri, options)
begin
@request.get(uri, options)
rescue Tankard::Error::HttpError
rescue Tankard::Error::LoadError
nil
end
end
Expand Down

0 comments on commit 174c2c6

Please sign in to comment.