Class RpcException (2.63.0)

public class RpcException : Exception, ISerializable

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

Inheritance

object > Exception > RpcException

Implements

ISerializable

Namespace

Grpc.Core

Assembly

Grpc.Core.Api.dll

Constructors

RpcException(Status)

public RpcException(Status status)

Creates a new RpcException associated with given status.

Parameter
Name Description
status Status

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
Name Description
status Status

Resulting status of a call.

trailers Metadata

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
Name Description
status Status

Resulting status of a call.

trailers Metadata

Response trailing metadata.

message string

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
Name Description
status Status

Resulting status of a call.

message string

The exception message.

Properties

Status

public Status Status { get; }

Resulting status of the call.

Property Value
Type Description
Status

StatusCode

public StatusCode StatusCode { get; }

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

Property Value
Type Description
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
Type Description
Metadata