Expand description
Procedural macro for deriving the GrpcError trait on error enums.
This macro simplifies the creation of gRPC-compatible error enums by automatically:
- Generating a companion error enum for gRPC serialization
- Implementing the
GrpcErrortrait - Providing proper error code mappings
- Generating
From<Error> for tonic::Statusconversion
§Example
ⓘ
use miden_node_grpc_error_macro::GrpcError;
use thiserror::Error;
#[derive(Debug, Error, GrpcError)]
pub enum GetNoteScriptByRootError {
#[error("database error")]
#[grpc(internal)]
DatabaseError(#[from] DatabaseError),
#[error("malformed script root")]
DeserializationFailed,
#[error("script with given root doesn't exist")]
ScriptNotFound,
}Derive Macros§
- Grpc
Error - Derives the
GrpcErrortrait for an error enum.