lib/mailgun/client.rb in mailgun-ruby-1.2.9 vs lib/mailgun/client.rb in mailgun-ruby-1.2.10
- old
+ new
@@ -203,10 +203,10 @@
# Raises CommunicationError and stores response in it if present
#
# @param [StandardException] e upstream exception object
def communication_error(e)
- if e.respond_to?(:response)
+ if e.respond_to?(:response) && e.response
return case e.response.code
when Unauthorized::CODE
Unauthorized.new(e.message, e.response)
when BadRequest::CODE
BadRequest.new(e.message, e.response)