aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2018-04-20 15:55:12 +0100
committerGravatar Jon Skeet <skeet@pobox.com>2018-04-20 16:00:50 +0100
commitcd9e9e7cc525faa0e4dbe0c4d30faae04d5f4859 (patch)
treefc6a41454292f9ec1229d4a0703546cdcb01ca78 /src
parent2a6f47354391af2514310ff06d44a26354cc07fb (diff)
Add RpcException.StatusCode property
This is purely for convenience - using `e.Status.StatusCode` looks clunky compared with `e.StatusCode`, and this is the property most likely to be used for exception filtering etc.
Diffstat (limited to 'src')
-rw-r--r--src/csharp/Grpc.Core/RpcException.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core/RpcException.cs b/src/csharp/Grpc.Core/RpcException.cs
index d2c912e73a..94429d74ce 100644
--- a/src/csharp/Grpc.Core/RpcException.cs
+++ b/src/csharp/Grpc.Core/RpcException.cs
@@ -73,6 +73,17 @@ namespace Grpc.Core
}
/// <summary>
+ /// Returns the status code of the call, as a convenient alternative to <see cref="StatusCode">Status.StatusCode</see>.
+ /// </summary>
+ public StatusCode StatusCode
+ {
+ get
+ {
+ return status.StatusCode;
+ }
+ }
+
+ /// <summary>
/// Gets the call trailing metadata.
/// Trailers only have meaningful content for client-side calls (in which case they represent the trailing metadata sent by the server when closing the call).
/// Instances of <c>RpcException</c> thrown by the server-side part of the stack will have trailers always set to empty.