Skip to content

Conversation

@seanpdoyle
Copy link
Contributor

With the changes made in 2ea5401, the underlying Net::HTTPRequest instance is available to the connection throughout the lifetime of the request. With that instance available, exceptions raised during the request-response handshake can be constructed with the Net::HTTPRequest instance.

Access to the Net::HTTPRequest from code that rescues from those exceptions is valuable:

  • for debugging purposes
  • for observability and logging
  • for retrying requests, etc.

However, the exception classes are documented and therefore their constructors are part of the public API. Inserting a request positional argument is a breaking change. To account for that, this commit includes deprecations for subclasses that call super from within #initialize to instruct them on changing the signature to account for the Net::HTTPRequest instance.

@seanpdoyle seanpdoyle force-pushed the exception-request branch 3 times, most recently from daccadd to cd7b484 Compare December 22, 2025 14:35
With the changes made in [2ea5401][], the underlying
[Net::HTTPRequest][] instance is available to the connection throughout
the lifetime of the request. With that instance available, exceptions
raised during the request-response handshake can be constructed with the
`Net::HTTPRequest` instance.

Access to the `Net::HTTPRequest` from code that rescues from those
exceptions is  valuable:

* for debugging purposes
* for observability and logging
* for retrying requests, etc.

However, the exception classes are documented and therefore their
constructors are part of the public API. Inserting a `request`
positional argument is a breaking change. To account for that, this
commit includes deprecations for subclasses that call `super` from
within `#initialize` to instruct them on changing the signature to
account for the `Net::HTTPRequest` instance.

[2ea5401]: rails@2ea5401
[Net::HTTPRequest]: https://docs.ruby-lang.org/en/master/Net/HTTPRequest.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant