Class RpcExceptionExtensions (4.2.0)

public static class RpcExceptionExtensions

Utility extension methods to make it easier to retrieve extended error information from an .

Inheritance

Object > RpcExceptionExtensions

Namespace

Google.Api.Gax.Grpc

Assembly

Google.Api.Gax.Grpc.dll

Methods

GetBadRequest(RpcException)

public static BadRequest GetBadRequest(this RpcException ex)

Retrieves the Google.Rpc.BadRequest message containing extended error information from the trailers in an , if present.

Parameter
NameDescription
exRpcException

The RPC exception to retrieve details from. Must not be null.

Returns
TypeDescription
Google.Rpc.BadRequest

The Google.Rpc.BadRequest message specified in the exception, or null if there is no such information.

GetErrorInfo(RpcException)

public static ErrorInfo GetErrorInfo(this RpcException ex)

Retrieves the Google.Rpc.ErrorInfo message containing extended error information from the trailers in an , if present.

Parameter
NameDescription
exRpcException

The RPC exception to retrieve details from. Must not be null.

Returns
TypeDescription
Google.Rpc.ErrorInfo

The Google.Rpc.ErrorInfo message specified in the exception, or null if there is no such information.

GetRpcStatus(RpcException)

public static Status GetRpcStatus(this RpcException ex)

Retrieves the Google.Rpc.Status message containing extended error information from the trailers in an , if present.

Parameter
NameDescription
exRpcException

The RPC exception to retrieve details from. Must not be null.

Returns
TypeDescription
Google.Rpc.Status

The Google.Rpc.Status message specified in the exception, or null if there is no such information.

GetStatusDetail<T>(RpcException)

public static T GetStatusDetail<T>(this RpcException ex)
    where T : class, IMessage<T>, new()

Retrieves the error details of type T from the Google.Rpc.Status message associated with an , if any.

Parameter
NameDescription
exRpcException

The RPC exception to retrieve details from. Must not be null.

Returns
TypeDescription
T
Type Parameter
NameDescription
T

The message type to decode from within the error details.