diff --git a/Google.Api.Gax.Grpc/RpcExceptionExtensions.cs b/Google.Api.Gax.Grpc/RpcExceptionExtensions.cs index c78db304..1acb4f92 100644 --- a/Google.Api.Gax.Grpc/RpcExceptionExtensions.cs +++ b/Google.Api.Gax.Grpc/RpcExceptionExtensions.cs @@ -6,7 +6,6 @@ */ using Google.Protobuf; -using Google.Protobuf.WellKnownTypes; using Google.Rpc; using Grpc.Core; using System.Linq; @@ -60,19 +59,9 @@ public static Rpc.Status GetRpcStatus(this RpcException ex) => public static T GetStatusDetail(this RpcException ex) where T : class, IMessage, new() { var status = GetRpcStatus(ex); - if (status is null) - { - return null; - } - var expectedName = new T().Descriptor.FullName; - var any = status.Details.FirstOrDefault(a => Any.GetTypeName(a.TypeUrl) == expectedName); - if (any is null) - { - return null; - } try { - return any.Unpack(); + return status.GetDetail(); } catch {