chore: improve error logs (#10933)

Signed-off-by: Prajilesh <[email protected]>

Signed-off-by: Prajilesh <[email protected]>
This commit is contained in:
Prajilesh N
2022-10-13 17:53:06 -04:00
committed by GitHub
parent 03a2844101
commit eeae87f157
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -382,7 +382,7 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e
cluster, err := c.db.GetCluster(context.Background(), server)
if err != nil {
return nil, err
return nil, fmt.Errorf("error getting cluster: %w", err)
}
if !c.canHandleCluster(cluster) {
@@ -456,11 +456,11 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e
func (c *liveStateCache) getSyncedCluster(server string) (clustercache.ClusterCache, error) {
clusterCache, err := c.getCluster(server)
if err != nil {
return nil, err
return nil, fmt.Errorf("error getting cluster: %w", err)
}
err = clusterCache.EnsureSynced()
if err != nil {
return nil, err
return nil, fmt.Errorf("error synchronizing cache state : %w", err)
}
return clusterCache, nil
}
@@ -594,7 +594,7 @@ func (c *liveStateCache) watchSettings(ctx context.Context) {
func (c *liveStateCache) Init() error {
cacheSettings, err := c.loadCacheSettings()
if err != nil {
return err
return fmt.Errorf("error loading cache settings: %w", err)
}
c.cacheSettings = *cacheSettings
return nil
+1 -1
View File
@@ -20,7 +20,7 @@ type repoAsCredentials struct {
func (r *repoAsCredentials) GetAuthSecret(ctx context.Context, secretName string) (*github_app_auth.Authentication, error) {
repo, err := r.GetRepoCredsBySecretName(ctx, secretName)
if err != nil {
return nil, err
return nil, fmt.Errorf("error getting creds for %s: %w", secretName, err)
}
if repo == nil || repo.GithubAppPrivateKey == "" {
return nil, fmt.Errorf("no github app found for %s", secretName)