GCM: Fix error checking for GCE project getter (#95613)

Appropriately check error
This commit is contained in:
Andreas Christou 2024-10-30 15:28:53 +00:00 committed by GitHub
parent fe4f44723d
commit 08e880a823
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -591,7 +591,10 @@ func (s *Service) ensureProject(ctx context.Context, dsInfo datasourceInfo, proj
func (s *Service) getDefaultProject(ctx context.Context, dsInfo datasourceInfo) (string, error) {
if dsInfo.authenticationType == gceAuthentication {
project, err := s.gceDefaultProjectGetter(ctx, cloudMonitorScope)
return project, errorsource.DownstreamError(err, false)
if err != nil {
return project, errorsource.DownstreamError(err, false)
}
return project, nil
}
return dsInfo.defaultProject, nil
}