Class ApiErrors
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
FieldKey
Metadata key naming the request field concerned.
public const string FieldKey = "field"
Field Value
ResourceKey
Metadata key naming the item concerned (an id, a key, a service).
public const string ResourceKey = "resource"
Field Value
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
exceptionRpcException
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
statusDetailsByteString
Returns
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
exceptionRpcException
Returns
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
codeStatusCodereasonstringmessagestringfieldstringresourcestringdetailsIMessage[]
Returns
InvalidField(string, string)
INVALID_ARGUMENT naming the request field (InvalidField).
public static RpcException InvalidField(string field, string message)
Parameters
Returns
NotFound(string, string)
NOT_FOUND naming the missing resource (NotFound).
public static RpcException NotFound(string resource, string message)
Parameters
Returns
StatusOf(StatusCode, string, string, string?, string?, params IMessage[])
The google.rpc.Status of a failure (see Failure(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
codeStatusCodereasonstringmessagestringfieldstringresourcestringdetailsIMessage[]