public struct Status
Represents RPC result, which consists of StatusCode and an optional detail string.
Namespace
Grpc.CoreAssembly
Grpc.Core.Api.dll
Constructors
Status(StatusCode, string)
public Status(StatusCode statusCode, string detail)
Creates a new instance of Status
.
Parameters | |
---|---|
Name | Description |
statusCode |
StatusCode Status code. |
detail |
string Detail. |
Status(StatusCode, string, Exception?)
public Status(StatusCode statusCode, string detail, Exception? debugException)
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.
Parameters | |
---|---|
Name | Description |
statusCode |
StatusCode Status code. |
detail |
string Detail. |
debugException |
Exception Optional internal error details. |
Fields
DefaultCancelled
public static readonly Status DefaultCancelled
Default result of a cancelled RPC. StatusCode=Cancelled, empty details message.
Field Value | |
---|---|
Type | Description |
Status |
DefaultSuccess
public static readonly Status DefaultSuccess
Default result of a successful RPC. StatusCode=OK, empty details message.
Field Value | |
---|---|
Type | Description |
Status |
Properties
DebugException
public readonly Exception? DebugException { get; }
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.
Property Value | |
---|---|
Type | Description |
Exception |
Detail
public readonly string Detail { get; }
Gets the detail.
Property Value | |
---|---|
Type | Description |
string |
StatusCode
public readonly StatusCode StatusCode { get; }
Gets the gRPC status code. OK indicates success, all other values indicate an error.
Property Value | |
---|---|
Type | Description |
StatusCode |
Methods
ToString()
public override string ToString()
Returns | |
---|---|
Type | Description |
string |