Skip to content

Commit

Permalink
Recover from exception while inspecting error response (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and mbacovsky committed Aug 11, 2016
1 parent d285cb6 commit 980f5db
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/apipie_bindings/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ def http_call(http_method, path, params={}, headers={}, options={})
update_cache(response.headers[:apipie_checksum])
rescue => e
clear_credentials if e.is_a? RestClient::Unauthorized
log.debug e.message + "\n" +
inspect_data(e.respond_to?(:response) ? process_data(e.response) : e)
log.error e.message
log.debug inspect_data(e)
raise
end
end
Expand Down Expand Up @@ -385,7 +385,10 @@ def process_data(response)
end

def inspect_data(obj)
ApipieBindings::Utils.inspect_data(obj)
ApipieBindings::Utils.inspect_data(obj.respond_to?(:response) ? process_data(obj.response) : obj)
rescue => e
log.debug "Error during inspecting response: #{e.message}"
''
end

def create_fake_response(status, body, method, path, args=[])
Expand Down

0 comments on commit 980f5db

Please sign in to comment.