This repository was archived by the owner on Oct 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +18
-17
lines changed
Expand file tree Collapse file tree 4 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -178,10 +178,10 @@ def make_connection options
178178 def validate ( response )
179179 if response . status >= 400
180180 error_class = ERRORS [ response . status ] || HelloSign ::Error ::UnknownError
181- error = error_class . new
182- error . response_status = response . status
183- error . response_body = response . body
184- error . request_uri = response . to_hash [ :url ] . to_s
181+ error = error_class . new ( response . status , response . body , response . to_hash [ :url ] . to_s )
182+ # error.response_status = response.status
183+ # error.response_body = response.body
184+ # error.request_uri = response.to_hash[:url].to_s
185185 raise error
186186 end
187187 end
Original file line number Diff line number Diff line change @@ -26,19 +26,20 @@ module HelloSign
2626 module Error
2727 # Custom error class for rescuing from all HelloSign errors.
2828 class Error < StandardError ;
29- attr_accessor :request_uri
30- attr_accessor :response_body
31- attr_accessor :response_status
29+ attr_accessor :request_uri , :response_body , :response_status
3230
33- def initialize ( message = nil )
34- super ( message || human_readable_message )
31+ def initialize ( response_status , response_body = nil , request_uri )
32+ @request_uri = request_uri
33+ @response_body = response_body
34+ @response_status = response_status
35+ super ( human_readable_message )
3536 end
3637
3738 private
3839 def human_readable_message
39- "Server responded with code #{ response_status } \n " \
40- "Request URI: #{ request_uri } \n " \
41- "Message: #{ response_body } "
40+ "Server responded with code #{ @ response_status} \n " \
41+ "Request URI: #{ @ request_uri} \n " \
42+ "Message: #{ @ response_body} "
4243 end
4344 end
4445
Original file line number Diff line number Diff line change 2323#
2424
2525module HelloSign
26- VERSION = '3.6.1 '
26+ VERSION = '3.6.2 '
2727end
Original file line number Diff line number Diff line change 22
33describe HelloSign ::Error do
44 # another test to prove backwards compatibility
5- describe 'custom error message' do
6- subject { HelloSign ::Error ::Error . new ( 'Foo' ) . message }
7- it { is_expected . to eql ( 'Foo' ) }
5+ it 'raises an error with any message' do
6+ error = HelloSign ::Error ::Error . new ( 404 , 'test error message' , 'http://www.test.com' )
7+ expect ( error ) . to be_instance_of ( HelloSign :: Error :: Error )
88 end
9- end
109
10+ end
You can’t perform that action at this time.
0 commit comments