I've run into a case when attempting to fetch a WSDL, and the server returns a 404 error. When wasabi handles this in resolver.rb, it raises an exception with the response object as the exception message:
def load_from_remote
request.url = document
response = HTTPI.get(request)
raise HTTPError, response if response.error? # <----
response.body
end
This get converted to a plain "#<HTTPI::Response:0x0000...>" string once it's passed into the HTTPError constructor, instead of a more meaningful exception message like "Error 404". Inspecting the HTTP::Response object itself, I don't see much that would be useful (since body may be an arbitrarily large blob of HTML), so I wonder if maybe at least including the response code would result in a saner-looking exception, i.e.:
raise HTTPError, "Error: #{response.code}" if response.error?
Even better, enhance the HTTPError exception class to wrap the faulty HTTPI::Response instance itself, rather than just its hex-addressed string representation.
I've run into a case when attempting to fetch a WSDL, and the server returns a 404 error. When wasabi handles this in resolver.rb, it raises an exception with the response object as the exception message:
This get converted to a plain
"#<HTTPI::Response:0x0000...>"
string once it's passed into theHTTPError
constructor, instead of a more meaningful exception message like "Error 404". Inspecting theHTTP::Response
object itself, I don't see much that would be useful (sincebody
may be an arbitrarily large blob of HTML), so I wonder if maybe at least including the response code would result in a saner-looking exception, i.e.:Even better, enhance the
HTTPError
exception class to wrap the faultyHTTPI::Response
instance itself, rather than just its hex-addressed string representation.