Skip to content

Commit

Permalink
Fixes #56 - do not hide exceptions during cache retrieval (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Strachota authored and mbacovsky committed Mar 22, 2017
1 parent b1e256d commit 3ce6227
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/apipie_bindings/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ def retrieve_apidoc
unless response
begin
response = retrieve_apidoc_call("/apidoc/v#{@api_version}.json")
rescue
rescue Exception => e
raise ApipieBindings::DocLoadingError.new(
"Could not load data from #{@uri}\n"\
"Could not load data from #{@uri}: #{e.message}\n"\
" - is your server down?\n"\
" - was rake apipie:cache run when using apipie cache? (typical production settings)")
" - was rake apipie:cache run when using apipie cache? (typical production settings)", e)
end
end
File.open(apidoc_cache_file, "w") { |f| f.write(response.body) }
Expand Down
8 changes: 7 additions & 1 deletion lib/apipie_bindings/exceptions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
module ApipieBindings

class ConfigurationError < StandardError; end
class DocLoadingError < StandardError; end
class DocLoadingError < StandardError
attr_reader :original_error
def initialize(msg, original_error)
super(msg)
@original_error = original_error
end
end
class AuthenticatorMissingError < StandardError; end

ErrorData = Struct.new(:kind, :argument, :details)
Expand Down

0 comments on commit 3ce6227

Please sign in to comment.