Skip to content

Add a typed failure reason to RequestError - #241

Open
SeanTAllen wants to merge 1 commit into
mainfrom
issue-225-request-failure-reason
Open

SeanTAllen wants to merge 1 commit into
mainfrom
issue-225-request-failure-reason

Conversation

@SeanTAllen

Copy link
Copy Markdown
Member

A caller that wanted to retry connection timeouts had to compare
RequestError.message with "Connection timed out", because a timeout and
a TLS handshake failure both gave status 0 and an empty body. Any change
to the wording silently changed what the caller did.

RequestError now has a reason: one of net's ConnectionFailureReason
values when the connection could not be opened, or a primitive for each
other kind of failure. The documentation says for each reason whether a
retry is safe. A connection that closes before any of the request is
written is now reported as RequestNotSent, separate from one that closes
after the request went out. Per-reason constructors replace
RequestError.create, and the receiver interfaces get the RequestError
instead of its fields.

Closes #225

A caller that wanted to retry connection timeouts had to compare
RequestError.message with "Connection timed out", because a timeout and
a TLS handshake failure both gave status 0 and an empty body. Any change
to the wording silently changed what the caller did.

RequestError now has a reason: one of net's ConnectionFailureReason
values when the connection could not be opened, or a primitive for each
other kind of failure. The documentation says for each reason whether a
retry is safe. A connection that closes before any of the request is
written is now reported as RequestNotSent, separate from one that closes
after the request went out. Per-reason constructors replace
RequestError.create, and the receiver interfaces get the RequestError
instead of its fields.

Closes #225
@SeanTAllen SeanTAllen added changelog - changed Automatically add "Changed" CHANGELOG entry on merge do not merge This PR should not be merged at this time labels Dec 4, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Dec 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - changed Automatically add "Changed" CHANGELOG entry on merge discuss during sync Should be discussed during an upcoming sync do not merge This PR should not be merged at this time

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose a typed failure reason on RequestError

2 participants