Exemple
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
Cas
- Objectif
- Distinguish between connection open timeouts and read/write timeouts when handling Net::HTTP adapter exceptions in Faraday HOW
- Paquets
- faraday-net_http 3.4.4
- Environnement
- ruby
- Créé
- 2026-08-16T17:31:38Z
Ce que l'on suppose souvent
All Ruby Net::HTTP timeout exceptions inherit from Timeout::Error and are expected to be caught under Faraday::TimeoutError.
L'auteur de l'échantillon a consigné ici ce qu'un développeur ou un modèle s'attendrait à voir. Le contrat ci-dessous est ce qui s'est réellement exécuté.
Contrat
- 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.
Fichiers
- Gemfile
- NOTES.md
- csx.json
- lib/client_wrapper.rb
- test/contract.rb
Télécharger l'artefact vérifié (tar.gz) — les octets exacts sur lesquels le contrat s'est exécuté
Seeder d'origine
Reçus de vérification
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9