Class RpcException (2.48.0)

public class RpcException : Exception

Thrown when remote procedure call fails. Every RpcException is associated with a resulting Status of the call.

Inheritance

Object > RpcException

Namespace

Grpc.Core

Assembly

Grpc.Core.Api.dll

Constructors

RpcException(Status)

public RpcException(Status status)

Creates a new RpcException associated with given status.

Parameter
NameDescription
statusStatus

Resulting status of a call.

RpcException(Status, Metadata)

public RpcException(Status status, Metadata trailers)

Creates a new RpcException associated with given status and trailing response metadata.

Parameters
NameDescription
statusStatus

Resulting status of a call.

trailersMetadata

Response trailing metadata.

RpcException(Status, Metadata, String)

public RpcException(Status status, Metadata trailers, string message)

Creates a new RpcException associated with given status, message and trailing response metadata. NOTE: the exception message is not sent to the remote peer. Use status.Details to pass error details to the peer.

Parameters
NameDescription
statusStatus

Resulting status of a call.

trailersMetadata

Response trailing metadata.

messageString

The exception message.

RpcException(Status, String)

public RpcException(Status status, string message)

Creates a new RpcException associated with given status and message. NOTE: the exception message is not sent to the remote peer. Use status.Details to pass error details to the peer.

Parameters
NameDescription
statusStatus

Resulting status of a call.

messageString

The exception message.

Properties

Status

public Status Status { get; }

Resulting status of the call.

Property Value
TypeDescription
Status

StatusCode

public StatusCode StatusCode { get; }

Returns the status code of the call, as a convenient alternative to Status.StatusCode.

Property Value
TypeDescription
StatusCode

Trailers

public Metadata Trailers { get; }

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 RpcException thrown by the server-side part of the stack will have trailers always set to empty.

Property Value
TypeDescription
Metadata