Struct Status
Represents RPC result, which consists of StatusCode and an optional detail string.
Inherited Members
Namespace: Grpc.Core
Assembly: Grpc.Core.Api.dll
Syntax
public struct Status
Constructors
Status(StatusCode, String)
Creates a new instance of Status
.
Declaration
public Status(StatusCode statusCode, string detail)
Parameters
Type | Name | Description |
---|---|---|
StatusCode | statusCode | Status code. |
System.String | detail | Detail. |
Status(StatusCode, String, Nullable<Exception>)
Creates a new instance of Status
.
Users should not use this constructor, except for creating instances for testing.
The debug error string should only be populated by gRPC internals.
Note: experimental API that can change or be removed without any prior notice.
Declaration
public Status(StatusCode statusCode, string detail, Exception? debugException)
Parameters
Type | Name | Description |
---|---|---|
StatusCode | statusCode | Status code. |
System.String | detail | Detail. |
System.Nullable<System.Exception> | debugException | Optional internal error details. |
Fields
DefaultCancelled
Default result of a cancelled RPC. StatusCode=Cancelled, empty details message.
Declaration
public static readonly Status DefaultCancelled
Field Value
Type | Description |
---|---|
Status |
DefaultSuccess
Default result of a successful RPC. StatusCode=OK, empty details message.
Declaration
public static readonly Status DefaultSuccess
Field Value
Type | Description |
---|---|
Status |
Properties
DebugException
In case of an error, this field may contain additional error details to help with debugging.
This field will be only populated on a client and its value is generated locally,
based on the internal state of the gRPC client stack (i.e. the value is never sent over the wire).
Note that this field is available only for debugging purposes, the application logic should
never rely on values of this field (it should use StatusCode
and Detail
instead).
Example: when a client fails to connect to a server, this field may provide additional details
why the connection to the server has failed.
Note: experimental API that can change or be removed without any prior notice.
Declaration
public Exception? DebugException { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Exception> |
Detail
Gets the detail.
Declaration
public string Detail { get; }
Property Value
Type | Description |
---|---|
System.String |
StatusCode
Gets the gRPC status code. OK indicates success, all other values indicate an error.
Declaration
public StatusCode StatusCode { get; }
Property Value
Type | Description |
---|---|
StatusCode |
Methods
ToString()
Returns a System.String that represents the current Status.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |