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

Extension methods that add support for the richer gRPC error model to .NET's gRPC implementation.

GitHub repository

Usage

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)
{
// ...
}
}