@@ -125,7 +125,7 @@ def response_handler(response)
125125 req = response . request
126126 url = req . url
127127 meth = req . options . fetch ( :method ) . to_s . upcase
128- it = [ meth , url ] . join ( ' ' )
128+ req_info = " #{ meth } #{ url } "
129129
130130 if response . timed_out?
131131 what , secs = if response . connect_time &.zero?
@@ -135,24 +135,24 @@ def response_handler(response)
135135 [ :request , req . options [ :timeout ] ]
136136 end
137137
138- raise Error ::Timeout , "#{ it } : #{ what } timed out after #{ secs } seconds"
138+ raise Error ::Timeout , "#{ req_info } : #{ what } timed out after #{ secs } seconds"
139139 end
140140
141141 case ( code = response . response_code )
142142 when 0
143- raise Error ::Empty , "#{ it } : Empty response from server (#{ response . status_message } )"
143+ raise Error ::Empty , "#{ req_info } : Empty response from server (#{ response . status_message } )"
144144 when 400
145- raise Error ::BadRequest , "#{ it } was a bad request"
145+ raise Error ::BadRequest , "#{ req_info } was a bad request"
146146 when 403
147- raise Error ::Forbidden , "#{ it } denied access"
147+ raise Error ::Forbidden , "#{ req_info } denied access"
148148 when 404
149- raise Error ::NotFound , "#{ it } was not found"
149+ raise Error ::NotFound , "#{ req_info } was not found"
150150 when 500
151- raise Error ::InternalServerError , "#{ it } : Server error (#{ response . body [ 0 ..120 ] } )"
151+ raise Error ::InternalServerError , "#{ req_info } : Server error (#{ response . body [ 0 ..120 ] } )"
152152 else
153153 app_error = parse_app_error_from ( response . body )
154154
155- raise Error ::HTTP . new ( code , "#{ it } failed with error #{ code } (#{ response . status_message } ): #{ app_error } " )
155+ raise Error ::HTTP . new ( code , "#{ req_info } failed with error #{ code } (#{ response . status_message } ): #{ app_error } " )
156156 end
157157 end
158158
0 commit comments