internal/cli drops its copies of vault.ErrSecretNotFound, ErrVaultNotFound, ErrVersionNotFound and ErrSecretExists and of the secret package's keychain and Secure Enclave errors, and its second error for an unknown unlocker type, an invalid mnemonic, a length below 1, an unsupported secret type and an oversized secret. vault.ErrNilValueBuffer becomes secret.ErrNilValueBuffer. Every error of secret.ReadPassphrase wraps ErrPassphraseNotRead. ResolveGPGKeyFingerprint returns ErrGPGKeyNotFound for a key the keyring lacks. storeInKeychain returns errNilDataBuffer. bip85's ErrPasswordTooShort and ErrEncodedTooShort go with their unreachable checks, as does the macOS check in macOS-only code. Tests that matched these errors' text use errors.Is. Model: opus-5-5
This commit was merged in pull request #114.
This commit is contained in:
@@ -23,7 +23,6 @@ const (
|
||||
|
||||
// Sentinel errors for version operations
|
||||
var (
|
||||
errVersionNotFound = errors.New("not found for secret")
|
||||
errCannotRemoveCurrentVersion = errors.New("promote another version first")
|
||||
)
|
||||
|
||||
@@ -156,7 +155,7 @@ func (cli *Instance) ListVersions(cmd *cobra.Command, secretName string) error {
|
||||
if !exists {
|
||||
secret.Debug("Secret not found", "secret_name", secretName)
|
||||
|
||||
return fmt.Errorf("secret '%s' %w", secretName, errSecretNotFound)
|
||||
return fmt.Errorf("secret '%s' %w", secretName, vault.ErrSecretNotFound)
|
||||
}
|
||||
|
||||
// List all versions
|
||||
@@ -289,7 +288,7 @@ func (cli *Instance) PromoteVersion(
|
||||
|
||||
if !exists {
|
||||
return fmt.Errorf("version '%s' %w '%s'",
|
||||
version, errVersionNotFound, secretName)
|
||||
version, vault.ErrVersionNotFound, secretName)
|
||||
}
|
||||
|
||||
// Update the current symlink using the proper function
|
||||
@@ -374,7 +373,7 @@ func (cli *Instance) findVersionToRemove(
|
||||
|
||||
if !exists {
|
||||
return versionToRemove{},
|
||||
fmt.Errorf("secret '%s' %w", secretName, errSecretNotFound)
|
||||
fmt.Errorf("secret '%s' %w", secretName, vault.ErrSecretNotFound)
|
||||
}
|
||||
|
||||
// Check if version exists
|
||||
@@ -386,7 +385,7 @@ func (cli *Instance) findVersionToRemove(
|
||||
|
||||
if !exists {
|
||||
return versionToRemove{}, fmt.Errorf("version '%s' %w '%s'",
|
||||
version, errVersionNotFound, secretName)
|
||||
version, vault.ErrVersionNotFound, secretName)
|
||||
}
|
||||
|
||||
// Get current version
|
||||
|
||||
Reference in New Issue
Block a user