Skip to content

Special case TimeoutError in ConnectError.from#1526

Merged
timostamm merged 2 commits intomainfrom
tstamm/Special-case-TimeoutError-in-ConnectError.from
Jul 9, 2025
Merged

Special case TimeoutError in ConnectError.from#1526
timostamm merged 2 commits intomainfrom
tstamm/Special-case-TimeoutError-in-ConnectError.from

Conversation

@timostamm
Copy link
Member

To abort an RPC, you pass an AbortSignal in the call options.

Usually, this is done by creating an AbortController, passing the controller's signal to the call options, and calling AbortController.abort() when necessary. The raised AbortError is automatically converted to the Connect error code canceled.

Alternatively it is also possible to create an AbortSignal via AbortSignal.timeout(). The signal will automatically abort after a specified time, with a TimeoutError. This error is currently converted to the Connect error code unknown, but it should be code canceled, same as with an AbortController.

This PR updates the behavior, closing #1453.

Note that it is not recommended to use AbortSignal.timeout() with RPCs, because the timeout cannot be propagated to the server. Instead, use the timeoutMs option (documentation).

timostamm added 2 commits July 7, 2025 16:19
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
@timostamm timostamm requested a review from srikrsna-buf July 7, 2025 14:34
@timostamm timostamm merged commit 1dc0f35 into main Jul 9, 2025
36 checks passed
@timostamm timostamm deleted the tstamm/Special-case-TimeoutError-in-ConnectError.from branch July 9, 2025 11:57
@timostamm timostamm mentioned this pull request Jul 25, 2025
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.

2 participants