lib/hello_sign/client.rb in hellosign-ruby-sdk-3.5.4 vs lib/hello_sign/client.rb in hellosign-ruby-sdk-3.6
- old
+ new
@@ -175,11 +175,15 @@
end
def validate(response)
if response.status >= 400
error_class = ERRORS[response.status] || HelloSign::Error::UnknownError
- raise error_class.new error_message(response)
+ error = error_class.new
+ error.response_status = response.status
+ error.response_body = response.body
+ error.request_uri = response.to_hash[:url].to_s
+ raise error
end
end
def parse(response)
if response['content-type'] == 'application/pdf'
@@ -189,15 +193,9 @@
elsif response.body.strip.empty?
{}
else
MultiJson.load response.body.strip
end
- end
-
- def error_message(response)
- "Server responded with code #{response.status}\n" \
- "Request URI: #{response.to_hash[:url].to_s}\n"\
- "Message: #{response.body}"
end
def MIMEfromName(name)
parts = name.split('.')
#default to pdf if no extension