Exception if grpc::GoogleDefaultCredentials fails and error handling

24 views
Skip to first unread message

Eugene Abramov

unread,
Oct 18, 2016, 4:16:27 AM10/18/16
to grpc.io
Hello, 

If the file application_default_credentials.json is missing the function grpc::GoogleDefaultCredentials fails with a critical error. How to fix it?

How to check for errors?

auto Credentials = grpc::GoogleDefaultCredentials ();      <- Exception here before return from this function
                     
if (Credentials) {    // It`s correct?
    
} else {  }  // If Error

And how to check for connect errors?

auto Channel = grpc::CreateChannel ("speech.googleapis.com", Credentials);

auto stub = GoogleSpeechAPI::Speech::NewStub (Channel);

Channel->GetState () ? 

Yang Gao

unread,
Nov 15, 2016, 5:11:50 PM11/15/16
to grpc.io
What kind of error are you seeing?
Are there any error logs printed?
Reply all
Reply to author
Forward
0 new messages