tonic
tonic copied to clipboard
feat(tonic): add From<BoxError> implementation for tonic::transport::Error
Addresses https://github.com/hyperium/tonic/issues/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.
What is the use case here, its not construct-able publicly for a reason.
What is the use case here, its not construct-able publicly for a reason.
this comment explains it: https://github.com/hyperium/tonic/issues/978#issuecomment-3209208871