From 37457cce5b0436493dba7cdac6e1af5f51d25f47 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 9 May 2020 14:52:07 -0700 Subject: 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. --- cmd/fscrypt/errors.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cmd') 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 -- cgit v1.2.3