mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-06 00:02:18 -04:00
Merge pull request #155 from stripe/fix-connection-error-message
Better error message for ServerBrokeConnection exception
This commit is contained in:
commit
afd42ecd41
@ -259,26 +259,31 @@ module Stripe
|
||||
end
|
||||
|
||||
def self.handle_restclient_error(e)
|
||||
case e
|
||||
when RestClient::ServerBrokeConnection, RestClient::RequestTimeout
|
||||
message = "Could not connect to Stripe (#{@api_base}). " +
|
||||
"Please check your internet connection and try again. " +
|
||||
"If this problem persists, you should check Stripe's service status at " +
|
||||
connection_message = "Please check your internet connection and try again. " \
|
||||
"If this problem persists, you should check Stripe's service status at " \
|
||||
"https://twitter.com/stripestatus, or let us know at support@stripe.com."
|
||||
|
||||
case e
|
||||
when RestClient::RequestTimeout
|
||||
message = "Could not connect to Stripe (#{@api_base}). #{connection_message}"
|
||||
|
||||
when RestClient::ServerBrokeConnection
|
||||
message = "The connection to the server (#{@api_base}) broke before the " \
|
||||
"request completed. #{connection_message}"
|
||||
|
||||
when RestClient::SSLCertificateNotVerified
|
||||
message = "Could not verify Stripe's SSL certificate. " +
|
||||
"Please make sure that your network is not intercepting certificates. " +
|
||||
"(Try going to https://api.stripe.com/v1 in your browser.) " +
|
||||
message = "Could not verify Stripe's SSL certificate. " \
|
||||
"Please make sure that your network is not intercepting certificates. " \
|
||||
"(Try going to https://api.stripe.com/v1 in your browser.) " \
|
||||
"If this problem persists, let us know at support@stripe.com."
|
||||
|
||||
when SocketError
|
||||
message = "Unexpected error communicating when trying to connect to Stripe. " +
|
||||
"You may be seeing this message because your DNS is not working. " +
|
||||
message = "Unexpected error communicating when trying to connect to Stripe. " \
|
||||
"You may be seeing this message because your DNS is not working. " \
|
||||
"To check, try running 'host stripe.com' from the command line."
|
||||
|
||||
else
|
||||
message = "Unexpected error communicating with Stripe. " +
|
||||
message = "Unexpected error communicating with Stripe. " \
|
||||
"If this problem persists, let us know at support@stripe.com."
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user