chore(cli): add details to persistent password error message (#4480)

Extends error message with a generic, OS-independent hint about
what the source of the error may be and a potential solution.

Also, modifies error message to avoid duplicate messages.

- kopia/kopia#4449
This commit is contained in:
Julio López
2025-03-31 21:10:21 -07:00
committed by GitHub
parent e0d3fc0fa5
commit ad33441fbc
2 changed files with 2 additions and 2 deletions

View File

@@ -84,7 +84,7 @@ func (c *App) getPasswordFromFlags(ctx context.Context, isCreate, allowPersisten
}
if !errors.Is(err, passwordpersist.ErrPasswordNotFound) {
return "", errors.Wrap(err, "error getting persistent password")
return "", errors.Wrap(err, "cannot get persistent password")
}
}

View File

@@ -33,7 +33,7 @@ func (keyringStrategy) GetPassword(ctx context.Context, configFile string) (stri
case errors.Is(err, keyring.ErrUnsupportedPlatform):
return "", ErrPasswordNotFound
default:
return "", errors.Wrap(err, "error retrieving password from OS keyring")
return "", errors.Wrap(err, "error retrieving password from OS keyring, the keyring may be locked, attempt unlocking it using the OS-specific method")
}
}