Skip to content

Make transport::error::Kind public, for better programmatic error handling #2563

@BatmanAoD

Description

@BatmanAoD

Feature Request

Crates

tonic

Motivation

The transport::error::Error type is quite opaque, and not amenable to programmatically distinguishing between different types of errors.

Proposal

There is a Kind enum that is currently pub(crate); I suggest making this pub and adding a public accessor to return the Kind.

If forwards-compatibility with potential future variants is a concern, the non_exhaustive attribute can be applied to the enum.

Alternatives

A set of public functions returning bool could be added to cover each type of error: is_transport_error, is_invalid_uri, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions