Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to get grpc::StatusCode from stream.Finish() #554

Open
root-kidik opened this issue Apr 28, 2024 · 0 comments
Open

Add support to get grpc::StatusCode from stream.Finish() #554

root-kidik opened this issue Apr 28, 2024 · 0 comments

Comments

@root-kidik
Copy link
Contributor

root-kidik commented Apr 28, 2024

pg_grpc_service_template

// Initiate the RPC. No actual actions have been taken thus far besides
// preparing to send the request.
auto stream = client_.SayHello(request, std::move(context));

Now:

try
{
    auto response = client_.SayHello(request, std::move(context)).Finish();
}
catch (const ugrpc::client::RpcError&)
{
    // ...
}

After:

if (auto result = client_.SayHello(request, std::move(context)).FinishWithError(); result.has_value())
    // ... result.value()
else
    // ... result.error()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant