Struct Status (2.48.0)

public struct Status

Represents RPC result, which consists of StatusCode and an optional detail string.

Namespace

Grpc.Core

Assembly

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, Nullable<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 Nullable<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
Nullable<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 a that represents the current Status.

Returns
Type Description
String