From d4065b959644e1d7e64c424c4c69926093011c04 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 3 Sep 2018 18:12:59 +0200 Subject: add constructor for RpcException --- src/csharp/Grpc.Core/RpcException.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/csharp/Grpc.Core/RpcException.cs') diff --git a/src/csharp/Grpc.Core/RpcException.cs b/src/csharp/Grpc.Core/RpcException.cs index 94429d74ce..ff89897565 100644 --- a/src/csharp/Grpc.Core/RpcException.cs +++ b/src/csharp/Grpc.Core/RpcException.cs @@ -33,10 +33,8 @@ namespace Grpc.Core /// Creates a new RpcException associated with given status. /// /// Resulting status of a call. - public RpcException(Status status) : base(status.ToString()) + public RpcException(Status status) : this(status, Metadata.Empty, status.ToString()) { - this.status = status; - this.trailers = Metadata.Empty; } /// @@ -44,10 +42,8 @@ namespace Grpc.Core /// /// Resulting status of a call. /// The exception message. - public RpcException(Status status, string message) : base(message) + public RpcException(Status status, string message) : this(status, Metadata.Empty, message) { - this.status = status; - this.trailers = Metadata.Empty; } /// @@ -55,7 +51,17 @@ namespace Grpc.Core /// /// Resulting status of a call. /// Response trailing metadata. - public RpcException(Status status, Metadata trailers) : base(status.ToString()) + public RpcException(Status status, Metadata trailers) : this(status, trailers, status.ToString()) + { + } + + /// + /// Creates a new RpcException associated with given status, message and trailing response metadata. + /// + /// Resulting status of a call. + /// Response trailing metadata. + /// The exception message. + public RpcException(Status status, Metadata trailers, string message) : base(message) { this.status = status; this.trailers = GrpcPreconditions.CheckNotNull(trailers); -- cgit v1.2.3