Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Detect Whether Error Is Result Of Timeout #3172

Closed
billyb2 opened this issue Mar 14, 2023 · 1 comment
Closed

Unable to Detect Whether Error Is Result Of Timeout #3172

billyb2 opened this issue Mar 14, 2023 · 1 comment
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@billyb2
Copy link

billyb2 commented Mar 14, 2023

Version
List the version(s) of hyper, and any relevant hyper dependency (such as h2 if this is related to HTTP/2).
h2: v0.3.14
hyper: v0.14.23

Platform
The output of uname -a (UNIX), or version and 32 or 64-bit (Windows)
Linux laptop2 6.2.5-zen1-1.1-zen #1 ZEN SMP PREEMPT_DYNAMIC x86_64 GNU/Linux

Description
While working on a codebase, I needed to detect whether the following error:

hyper::Error(
    Io,
    Kind(
        TimedOut,
    ),
)

has Kind set to timeout. The is_timeout function just checks the Cause, but not the Kind. Kind is also a private variable with no way (that I could find) to get a reference to it. Is there another way to do what I'm trying to do?

@billyb2 billyb2 added the C-bug Category: bug. Something is wrong. This is bad! label Mar 14, 2023
@seanmonstar
Copy link
Member

Being that hyper says it's an Io error, the Kind is actually from std::io::Error. So, you can grab the source(), downcast to an io::Error, and inspect that.

@seanmonstar seanmonstar closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad!
Projects
None yet
Development

No branches or pull requests

2 participants