Skip to content
Discussion options

You must be logged in to vote

I haven't tested it with a client but something like

// build the grpc service
let reflection_service = tonic_reflection::server::Builder::configure()
    .register_encoded_file_descriptor_set(proto::FILE_DESCRIPTOR_SET)
    .build()
    .unwrap();
let grpc = tonic::transport::Server::builder()
    .add_service(reflection_service)
    .add_service(GreeterServer::new(GrpcServiceImpl::default()))
    .into_service();
// need to map the error type to `Infallible`
let grpc = HandleErrorLayer::new(|err: BoxError| async move {
    tracing::error!(err, "grpc service failed");
    // from https://docs.rs/tonic/latest/src/tonic/status.rs.html#100
    let internal_error_code = 13;
    [("grpc-status",

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@frederikhors
Comment options

@frederikhors
Comment options

@frederikhors
Comment options

@frederikhors
Comment options

Answer selected by frederikhors
Comment options

You must be logged in to vote
2 replies
@frederikhors
Comment options

@davidpdrsn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants