Class FromResultToRpcExceptionExtension
Turns a failed FluentResults.Result into the fault a gRPC service throws. Everything is derived from the very ProblemDetails the REST endpoints return (ToProblemDetails()), so both transports report a failure identically. The ProblemDetails itself travels along following the gRPC richer error model: packed as an arc4u.grpc.v1.ProblemDetails in the google.rpc.Status of the grpc-status-details-bin trailer, which every gRPC language has a helper to read. The .NET client-side counterpart is FromRpcExceptionToResultExtension in Arc4u.gRPC.
public static class FromResultToRpcExceptionExtension
- Inheritance
-
FromResultToRpcExceptionExtension
- Inherited Members
Methods
ToRpcException(Result)
Converts a failed result into the RpcException to throw back to the caller.
public static RpcException ToRpcException(this Result result)
Parameters
resultResultThe failed result to convert.
Returns
- RpcException
An RpcException carrying the gRPC equivalent of the result's ProblemDetails.
Remarks
As with ToProblemDetails(), converting a successful result is a programming error: it is reported as an unexpected failure.
ToRpcException<TValue>(Result<TValue>)
Converts a failed result into the RpcException to throw back to the caller.
public static RpcException ToRpcException<TValue>(this Result<TValue> result)
Parameters
resultResult<TValue>The failed result to convert.
Returns
- RpcException
An RpcException carrying the gRPC equivalent of the result's ProblemDetails.
Type Parameters
TValueThe type carried by the result.
Remarks
As with ToProblemDetails(), converting a successful result is a programming error: it is reported as an unexpected failure.