Class RpcException
Thrown when remote procedure call fails. Every RpcException
is associated with a resulting Status of the call.
Inheritance
Implements
Inherited Members
Namespace: Grpc.Core
Assembly: Grpc.Core.Api.dll
Syntax
public class RpcException : Exception, _Exception, ISerializable
Constructors
RpcException(Status)
Creates a new RpcException
associated with given status.
Declaration
public RpcException(Status status)
Parameters
Type | Name | Description |
---|---|---|
Status | status | Resulting status of a call. |
RpcException(Status, Metadata)
Creates a new RpcException
associated with given status and trailing response metadata.
Declaration
public RpcException(Status status, Metadata trailers)
Parameters
Type | Name | Description |
---|---|---|
Status | status | Resulting status of a call. |
Metadata | trailers | Response trailing metadata. |
RpcException(Status, Metadata, String)
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.
Declaration
public RpcException(Status status, Metadata trailers, string message)
Parameters
Type | Name | Description |
---|---|---|
Status | status | Resulting status of a call. |
Metadata | trailers | Response trailing metadata. |
System.String | message | The exception message. |
RpcException(Status, String)
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.
Declaration
public RpcException(Status status, string message)
Parameters
Type | Name | Description |
---|---|---|
Status | status | Resulting status of a call. |
System.String | message | The exception message. |
Properties
Status
Resulting status of the call.
Declaration
public Status Status { get; }
Property Value
Type | Description |
---|---|
Status |
StatusCode
Returns the status code of the call, as a convenient alternative to StatusCode.
Declaration
public StatusCode StatusCode { get; }
Property Value
Type | Description |
---|---|
StatusCode |
Trailers
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.
Declaration
public Metadata Trailers { get; }
Property Value
Type | Description |
---|---|
Metadata |