Skip to content

feat(tonic): add From<BoxError> implementation for tonic::transport::Error #2394

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gabotechs
Copy link

@gabotechs gabotechs commented Aug 21, 2025

Addresses #978

This PR keeps the tonic::transport::Error constructor methods private while allowing external users to map BoxErrors into tonic::transpoert::Error, which makes it possible to do something like:

fn test() -> Result<(), crate::transport::Error> {
    let err = Err(crate::BoxError::from("test"));
    err?;
    Ok(())
}

More details about why users would want to build tonic::transport::Error in the issue.

Also, completely open to alternatives.

@LucioFranco
Copy link
Member

What is the use case here, its not construct-able publicly for a reason.

@gabotechs
Copy link
Author

What is the use case here, its not construct-able publicly for a reason.

this comment explains it:
#978 (comment)

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