Skip to content
Snippets Groups Projects
Commit 40ea2d3a authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

improve examples in CustomErrorDetails test

parent a87f6d82
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,7 @@ namespace Grpc.IntegrationTesting
}
[Test]
public async Task UnaryCall()
public async Task ErrorDetailsFromCallObject()
{
var call = client.UnaryCallAsync(new SimpleRequest { ResponseSize = 10 });
......@@ -83,7 +83,24 @@ namespace Grpc.IntegrationTesting
}
}
private DebugInfo GetDebugInfo(Metadata trailers)
[Test]
public async Task ErrorDetailsFromRpcException()
{
try
{
await client.UnaryCallAsync(new SimpleRequest { ResponseSize = 10 });
Assert.Fail();
}
catch (RpcException e)
{
Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode);
var debugInfo = GetDebugInfo(e.Trailers);
Assert.AreEqual(debugInfo.Detail, ExceptionDetail);
Assert.IsNotEmpty(debugInfo.StackEntries);
}
}
private static DebugInfo GetDebugInfo(Metadata trailers)
{
var entry = trailers.First((e) => e.Key == DebugInfoTrailerName);
return DebugInfo.Parser.ParseFrom(entry.ValueBytes);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment