Skip to content

Act on TLS errors only #1652

Closed
Closed
@rolftimmermans

Description

@rolftimmermans

I am using hyper & hyper-tls to connect to HTTPS endpoints.

I want to do something specific if the endpoint has an invalid TLS certificate or configuration. It seems there is no way to distinguish between all these kinds of errors right now?

I think the error will internally be represented as Kind::Connect, but I'm not entirely sure. There seems to be a TODO to expose is_connect(). This might be what I need.

However, I really wish Kind were public, or maybe a less granular public enum that allows me to distinguish various classes of errors (for example: UserError, ParseError, ConnectError, Closed, Timeout). All the is_* methods on Error are not ergonomic (quickly turns into many if/else-if statements) and are too easily incomplete when new types of errors are added. I see it in other libraries but I severely dislike it and I never manage to correctly and thoroughly handle all errors this way. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions