Class RpcExceptionExtensions (4.4.0)

public static class RpcExceptionExtensions

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

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 RpcException, if present.

Parameter
Name Description
ex RpcException

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

Returns
Type Description
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 RpcException, if present.

Parameter
Name Description
ex RpcException

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

Returns
Type Description
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 RpcException, if present.

Parameter
Name Description
ex RpcException

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

Returns
Type Description
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 RpcException, if any.

Parameter
Name Description
ex RpcException

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

Returns
Type Description
T
Type Parameter
Name Description
T

The message type to decode from within the error details.