Table of Contents

Class ApiErrors

Namespace
Virtufin.Api.Client
Assembly
Virtufin.Api.Client.dll

Building and reading the api's failures (openspec write-results): a non-OK status with a google.rpc.Status whose details hold an ErrorInfo, carried in the standard grpc-status-details-bin trailer (gRPC and gRPC-Web alike).

public static class ApiErrors
Inheritance
ApiErrors
Inherited Members

Fields

Domain

The ErrorInfo.domain of the api's failures.

public const string Domain = "api.virtufin.com"

Field Value

string

FieldKey

Metadata key naming the request field concerned.

public const string FieldKey = "field"

Field Value

string

ResourceKey

Metadata key naming the item concerned (an id, a key, a service).

public const string ResourceKey = "resource"

Field Value

string

Methods

DetailOf<T>(RpcException)

A further detail of a failure (e.g. PublishEventsFailure), or null.

public static T? DetailOf<T>(this RpcException exception) where T : class, IMessage<T>, new()

Parameters

exception RpcException

Returns

T

Type Parameters

T

ErrorInfoOf(ByteString)

The ErrorInfo of a proxied call's failure (InvokeResponse.status_details), or null when the bytes are empty or carry none.

public static ApiError? ErrorInfoOf(ByteString statusDetails)

Parameters

statusDetails ByteString

Returns

ApiError

ErrorInfoOf(RpcException)

The ErrorInfo of a failure, or null when it carries none (a failure of the transport, or of a service that does not attach one).

public static ApiError? ErrorInfoOf(this RpcException exception)

Parameters

exception RpcException

Returns

ApiError

Failure(StatusCode, string, string, string?, string?, params IMessage[])

A failure to throw: code, message, and an ErrorInfo with reason, field and resource, plus any further details (a per-item outcome).

public static RpcException Failure(StatusCode code, string reason, string message, string? field = null, string? resource = null, params IMessage[] details)

Parameters

code StatusCode
reason string
message string
field string
resource string
details IMessage[]

Returns

RpcException

InvalidField(string, string)

INVALID_ARGUMENT naming the request field (InvalidField).

public static RpcException InvalidField(string field, string message)

Parameters

field string
message string

Returns

RpcException

NotFound(string, string)

NOT_FOUND naming the missing resource (NotFound).

public static RpcException NotFound(string resource, string message)

Parameters

resource string
message string

Returns

RpcException

StatusOf(StatusCode, string, string, string?, string?, params IMessage[])

public static Status StatusOf(StatusCode code, string reason, string message, string? field = null, string? resource = null, params IMessage[] details)

Parameters

code StatusCode
reason string
message string
field string
resource string
details IMessage[]

Returns

Status