From 94e296c3574180178337720dac505a6662dcd252 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 13 Mar 2015 16:06:56 -0700 Subject: [PATCH] Add error logs when credentials are created with non-positive lifetimes --- src/cpp/client/secure_credentials.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index fa5ce1e5d48..c0dfaef3a53 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -99,6 +99,8 @@ std::unique_ptr ServiceAccountCredentials( const grpc::string& json_key, const grpc::string& scope, std::chrono::seconds token_lifetime) { if (token_lifetime.count() <= 0) { + gpr_log(GPR_ERROR, + "Trying to create JWTCredentials with non-positive lifetime"); return WrapCredentials(nullptr); } gpr_timespec lifetime = gpr_time_from_seconds(token_lifetime.count()); @@ -110,6 +112,8 @@ std::unique_ptr ServiceAccountCredentials( std::unique_ptr JWTCredentials( const grpc::string &json_key, std::chrono::seconds token_lifetime) { if (token_lifetime.count() <= 0) { + gpr_log(GPR_ERROR, + "Trying to create JWTCredentials with non-positive lifetime"); return WrapCredentials(nullptr); } gpr_timespec lifetime = gpr_time_from_seconds(token_lifetime.count());