aboutsummaryrefslogtreecommitdiff
path: root/cmd/fscrypt
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-09 14:52:07 -0700
committerEric Biggers <ebiggers@google.com>2020-05-09 15:21:31 -0700
commit37457cce5b0436493dba7cdac6e1af5f51d25f47 (patch)
tree8f2e234aab045971fd5f4f74ff2836a4e19aa9a8 /cmd/fscrypt
parente9919b0bfd00c7d228531ebafa410cbfdafcb2e3 (diff)
actions/protector: improve errors
ErrProtectorName: Rename to ErrLoginProtectorName for clarity, and include the name and user. ErrMissingProtectorName: Include the correct protector source. ErrDuplicateName: Rename to ErrProtectorNameExists for clarity, and remove a level of wrapping by including the name directly. ErrDuplicateUID: Rename to ErrLoginProtectorExists for clarity, and remove a level of wrapping by including the user directly.
Diffstat (limited to 'cmd/fscrypt')
-rw-r--r--cmd/fscrypt/errors.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/fscrypt/errors.go b/cmd/fscrypt/errors.go
index e7c025f..829a9d2 100644
--- a/cmd/fscrypt/errors.go
+++ b/cmd/fscrypt/errors.go
@@ -82,6 +82,10 @@ func getErrorSuggestions(err error) string {
switch err.(type) {
case *actions.ErrBadConfigFile:
return `Either fix this file manually, or run "sudo fscrypt setup" to recreate it.`
+ case *actions.ErrLoginProtectorName:
+ return fmt.Sprintf("To fix this, don't specify the %s option.", shortDisplay(nameFlag))
+ case *actions.ErrMissingProtectorName:
+ return fmt.Sprintf("Use %s to specify a protector name.", shortDisplay(nameFlag))
case *actions.ErrNoConfigFile:
return `Run "sudo fscrypt setup" to create this file.`
}
@@ -131,8 +135,6 @@ func getErrorSuggestions(err error) string {
return `The metadata for this encrypted directory is in an
inconsistent state. This most likely means the filesystem
metadata is corrupted.`
- case actions.ErrMissingProtectorName:
- return fmt.Sprintf("Use %s to specify a protector name.", shortDisplay(nameFlag))
case actions.ErrAccessDeniedPossiblyV2:
return fmt.Sprintf(`This may be caused by the directory using a v2
encryption policy and the current kernel not supporting it. If