GrpcError

Derive Macro GrpcError 

Source
#[derive(GrpcError)]
{
    // Attributes available to this derive:
    #[grpc]
}
Expand description

Derives the GrpcError trait for an error enum.

§Attributes

  • #[grpc(internal)] - Marks a variant as an internal error (will map to tonic::Code::Internal)

§Generated Code

This macro generates:

  1. A companion *GrpcError enum with #[repr(u8)] for wire serialization
  2. An implementation of the GrpcError trait for the companion enum
  3. A method api_error() on the original enum that maps to the companion enum
  4. An implementation of From<Error> for tonic::Status for automatic error conversion