File: errors.md

package info (click to toggle)
ruby-faraday 2.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,008 kB
  • sloc: ruby: 6,509; sh: 10; makefile: 8
file content (17 lines) | stat: -rw-r--r-- 1,288 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Dealing with Errors

As an abstraction layer between the user and the underlying HTTP library,
it's important that Faraday provides a consistent interface for dealing with errors.
This is especially important when dealing with multiple adapters, as each adapter may raise different errors.

Below is a list of errors that Faraday may raise, and that you should be prepared to handle.

| Error                       | Description                                                                    |
|-----------------------------|--------------------------------------------------------------------------------|
| `Faraday::Error`            | Base class for all Faraday errors, also used for generic or unexpected errors. |
| `Faraday::ConnectionFailed` | Raised when the connection to the remote server failed.                        |
| `Faraday::TimeoutError`     | Raised when the connection to the remote server timed out.                     |
| `Faraday::SSLError`         | Raised when the connection to the remote server failed due to an SSL error.    |

If you add the `raise_error` middleware, Faraday will also raise additional errors for 4xx and 5xx responses.
You can find the full list of errors in the [raise_error middleware](/middleware/included/raising-errors) page.