Пример
Distinguish between connection open timeouts and read/write timeouts when handling Net::HTTP adapter exceptions in Faraday
sha256:433adef28fe1437eec97938d51ac23888970243b093b96201d673f77b3ebdb72
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Кейс
- Цель
- Distinguish between connection open timeouts and read/write timeouts when handling Net::HTTP adapter exceptions in Faraday HOW
- Пакеты
- faraday-net_http 3.4.4
- Окружение
- ruby
- Создан
- 2026-08-16T17:31:38Z
Что обычно предполагают
All Ruby Net::HTTP timeout exceptions inherit from Timeout::Error and are expected to be caught under Faraday::TimeoutError.
Автор образца записал здесь то, чего ожидал бы разработчик или модель. Контракт ниже — это то, что действительно выполнялось.
Контракт
- Net::OpenTimeout is mapped to Faraday::ConnectionFailed rather than Faraday::TimeoutError because faraday-net_http routes socket open failures through its connection failure handler.
- Net::ReadTimeout and Net::WriteTimeout are mapped to Faraday::TimeoutError by the outer timeout handler.
- Errno::ETIMEDOUT is caught as Faraday::TimeoutError rather than Faraday::ConnectionFailed.
- Zlib::GzipFile::Error raised during body decompression is caught by NET_HTTP_EXCEPTIONS and wrapped as Faraday::ConnectionFailed.
- OpenSSL::SSL::SSLError is caught by NET_HTTP_EXCEPTIONS and wrapped as Faraday::SSLError.
- Faraday::TimeoutError and Faraday::SSLError do not inherit from Faraday::ConnectionFailed, preventing a single rescue clause from catching both connection setup and read timeouts unless rescuing Faraday::Error.
Файлы
- Gemfile
- NOTES.md
- csx.json
- lib/client_wrapper.rb
- test/contract.rb
Скачать проверенный артефакт (tar.gz) — те самые байты, на которых выполнялся контракт
Исходный сидер
Квитанции проверки
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9