gRPC Rich Error  0.1.1
Richer gRPC error model support for .NET
gRPC Rich Error Documentation

Adds support for the richer gRPC error model to gRPC for .NET via extension methods.

GitHub repository

Usage

Add a reference to the GrpcRichError package to your project and use the namespace:

using GrpcRichError;

To throw an RPC exception with a rich error details:

throw new Google.Rpc.Status
{
Code = (int)StatusCode.NotFound,
Message = "some message",
Details =
{
new ErrorInfo
{
Domain = "example.com",
Reason = "some reason"
},
new BadRequest
{
// ...
}
}
}.ToException();

To extract rich error details from an RPC exception:

try
{
// ...
}
catch (RpcException ex)
{
var info = ex.GetDetail<ErrorInfo>();
if (info != null)
{
// ...
}
}