Skip to content

Errors and Exceptions

Simon Arlott edited this page Aug 8, 2021 · 4 revisions

If a request was sent and response has been received, there will be no exception regardless of response HTTP status. So the only exceptions you might expect are really bad things.

To catch bad things that occurred during connection/request/response stages you might rescue from HTTP::Error or any of the errors from the list in http/errors.rb.

For HTTPS requests, OpenSSL::SSL::SSLError could be raised.

For an invalid initial or redirected URI, Addressable::URI::InvalidURIError will be raised.

Any other exceptions that might be raised are basically unrecoverable runtime errors (e.g. wrong arguments/types).