public RpcException(Status status, Metadata trailers, string message)
Creates a newRpcExceptionassociated with given status, message and trailing response metadata.
NOTE: the exception message is not sent to the remote peer. Usestatus.Detailsto pass error
details to the peer.
public RpcException(Status status, string message)
Creates a newRpcExceptionassociated with given status and message.
NOTE: the exception message is not sent to the remote peer. Usestatus.Detailsto pass error
details to the peer.
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 ofRpcExceptionthrown by the server-side part of the stack will have trailers always set to empty.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eRpcException\u003c/code\u003e is thrown when a remote procedure call fails, and it is associated with a \u003ccode\u003eStatus\u003c/code\u003e that indicates the outcome of the call.\u003c/p\u003e\n"],["\u003cp\u003eThis class inherits from \u003ccode\u003eException\u003c/code\u003e and implements \u003ccode\u003eISerializable\u003c/code\u003e, providing functionalities like retrieving the base exception, getting object data, and accessing inherited members.\u003c/p\u003e\n"],["\u003cp\u003eThere are four constructors for \u003ccode\u003eRpcException\u003c/code\u003e, which allow creating exceptions with a \u003ccode\u003eStatus\u003c/code\u003e, optionally including \u003ccode\u003eMetadata\u003c/code\u003e and a message, however, it is important to note that the exception message is not sent to the remote peer, using \u003ccode\u003estatus.Details\u003c/code\u003e is needed to pass error details to the peer.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRpcException\u003c/code\u003e class provides properties such as \u003ccode\u003eStatus\u003c/code\u003e, \u003ccode\u003eStatusCode\u003c/code\u003e, and \u003ccode\u003eTrailers\u003c/code\u003e, which offer detailed information about the call's outcome and metadata.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTrailers\u003c/code\u003e property is only meaningful for client-side calls and represents the trailing metadata sent by the server; server-side exceptions will have empty trailers.\u003c/p\u003e\n"]]],[],null,["# Class RpcException (2.66.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.66.0 (latest)](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.RpcException)\n- [2.63.0](/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.RpcException)\n- [2.48.0](/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.RpcException) \n\n public class RpcException : Exception, ISerializable\n\nThrown when remote procedure call fails. Every `RpcException` is associated with a resulting [Status](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.RpcException#Grpc_Core_RpcException_Status) of the call. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e [Exception](https://learn.microsoft.com/dotnet/api/system.exception) \\\u003e RpcException \n\nImplements\n----------\n\n[ISerializable](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.iserializable) \n\nInherited Members\n-----------------\n\n[Exception.GetBaseException()](https://learn.microsoft.com/dotnet/api/system.exception.getbaseexception) \n[Exception.GetObjectData(SerializationInfo, StreamingContext)](https://learn.microsoft.com/dotnet/api/system.exception.getobjectdata) \n[Exception.GetType()](https://learn.microsoft.com/dotnet/api/system.exception.gettype) \n[Exception.ToString()](https://learn.microsoft.com/dotnet/api/system.exception.tostring) \n[Exception.Data](https://learn.microsoft.com/dotnet/api/system.exception.data) \n[Exception.HelpLink](https://learn.microsoft.com/dotnet/api/system.exception.helplink) \n[Exception.HResult](https://learn.microsoft.com/dotnet/api/system.exception.hresult) \n[Exception.InnerException](https://learn.microsoft.com/dotnet/api/system.exception.innerexception) \n[Exception.Message](https://learn.microsoft.com/dotnet/api/system.exception.message) \n[Exception.Source](https://learn.microsoft.com/dotnet/api/system.exception.source) \n[Exception.StackTrace](https://learn.microsoft.com/dotnet/api/system.exception.stacktrace) \n[Exception.TargetSite](https://learn.microsoft.com/dotnet/api/system.exception.targetsite) \n[Exception.SerializeObjectState](https://learn.microsoft.com/dotnet/api/system.exception.serializeobjectstate) \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Grpc.Core](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)\n\nAssembly\n--------\n\nGrpc.Core.Api.dll\n\nConstructors\n------------\n\n### RpcException(Status)\n\n public RpcException(Status status)\n\nCreates a new `RpcException` associated with given status.\n\n### RpcException(Status, Metadata)\n\n public RpcException(Status status, Metadata trailers)\n\nCreates a new `RpcException` associated with given status and trailing response metadata.\n\n### RpcException(Status, Metadata, string)\n\n public RpcException(Status status, Metadata trailers, string message)\n\nCreates a new `RpcException` associated with given status, message and trailing response metadata.\nNOTE: the exception message is not sent to the remote peer. Use `status.Details` to pass error\ndetails to the peer.\n\n### RpcException(Status, string)\n\n public RpcException(Status status, string message)\n\nCreates a new `RpcException` associated with given status and message.\nNOTE: the exception message is not sent to the remote peer. Use `status.Details` to pass error\ndetails to the peer.\n\nProperties\n----------\n\n### Status\n\n public Status Status { get; }\n\nResulting status of the call.\n\n### StatusCode\n\n public StatusCode StatusCode { get; }\n\nReturns the status code of the call, as a convenient alternative to [Status.StatusCode](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.RpcException#Grpc_Core_RpcException_StatusCode).\n\n### Trailers\n\n public Metadata Trailers { get; }\n\nGets the call trailing metadata.\nTrailers only have meaningful content for client-side calls (in which case they represent the trailing metadata sent by the server when closing the call).\nInstances of `RpcException` thrown by the server-side part of the stack will have trailers always set to empty."]]