lib/peatio/bitgo/client.rb in peatio-bitgo-1.1.1 vs lib/peatio/bitgo/client.rb in peatio-bitgo-1.1.2
- old
+ new
@@ -41,10 +41,14 @@
response.assert_success!
response = JSON.parse(response.body)
response['error'].tap { |error| raise ResponseError.new(error) if error }
response
rescue Faraday::Error => e
- raise ConnectionError, e
+ if e.is_a?(Faraday::ConnectionFailed) || e.is_a?(Faraday::TimeoutError)
+ raise ConnectionError, e
+ else
+ raise ConnectionError, JSON.parse(e.response.body)['message']
+ end
rescue StandardError => e
raise Error, e
end
end
end