aboutsummaryrefslogtreecommitdiff
path: root/actions/context.go
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-09 15:27:24 -0700
committerGitHub <noreply@github.com>2020-05-09 15:27:24 -0700
commitd4d28232d32bfb3f4827fcb79bd5043e1932ae66 (patch)
treedda5a65b2d8c157e03d3d35f3442547dafd51e4c /actions/context.go
parent1cdefc21b8b07aad7aafeefd05d3124cf93b9216 (diff)
parent181600d6327ed34a3f62eda0dd03a6d2ae49e5f9 (diff)
Merge pull request #219 from ebiggers/improve-errors
Improve error messages and suggestions
Diffstat (limited to 'actions/context.go')
-rw-r--r--actions/context.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/actions/context.go b/actions/context.go
index 0db0671..26295ec 100644
--- a/actions/context.go
+++ b/actions/context.go
@@ -40,14 +40,8 @@ import (
"github.com/google/fscrypt/util"
)
-// Errors relating to Config files or Config structures.
-var (
- ErrNoConfigFile = errors.New("global config file does not exist")
- ErrBadConfigFile = errors.New("global config file has invalid data")
- ErrConfigFileExists = errors.New("global config file already exists")
- ErrBadConfig = errors.New("invalid Config structure provided")
- ErrLocked = errors.New("key needs to be unlocked first")
-)
+// ErrLocked indicates that the key hasn't been unwrapped yet.
+var ErrLocked = errors.New("key needs to be unlocked first")
// Context contains the necessary global state to perform most of fscrypt's
// actions.
@@ -126,7 +120,7 @@ func newContextFromUser(targetUser *user.User) (*Context, error) {
// which is being used with fscrypt.
func (ctx *Context) checkContext() error {
if err := ctx.Config.CheckValidity(); err != nil {
- return errors.Wrap(ErrBadConfig, err.Error())
+ return &ErrBadConfig{ctx.Config, err}
}
return ctx.Mount.CheckSetup()
}