public static RpcException FailedPreconditionRpcException <TResponse>(this ServerCallContext context, DomainValidationResult <TResponse> result) where TResponse : class { var status = new Status(StatusCode.FailedPrecondition, Detail); var trailers = new Metadata { { Errors, result.ToJsonErrors() } }; return(context.RpcException(status, trailers)); }