From 66fb4c557644ba2c37951a7568c06c47a6c718a7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 9 May 2020 14:52:07 -0700 Subject: filesystem: improve errors Introduce filesystem.ErrEncryptionNotEnabled and filesystem.ErrEncryptionNotSupported which include the Mount as context, and translate the corresponding metadata/ errors into them. Then make these errors show much better suggestions. Also replace lots of other filesystem/ errors with either custom types or with unnamed one-off errors that include more context. Fix backwards wrapping in lots of cases. Finally, don't include the mountpoint in places where it's not useful, like OS-level errors that already include the path. --- filesystem/filesystem_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'filesystem/filesystem_test.go') diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go index 4bed96a..9b534bd 100644 --- a/filesystem/filesystem_test.go +++ b/filesystem/filesystem_test.go @@ -27,7 +27,6 @@ import ( "testing" "github.com/golang/protobuf/proto" - "github.com/pkg/errors" "github.com/google/fscrypt/crypto" "github.com/google/fscrypt/metadata" @@ -367,7 +366,7 @@ func TestLinkedProtector(t *testing.T) { // Get the protector though the second system _, err = fakeMnt.GetRegularProtector(protector.ProtectorDescriptor) - if errors.Cause(err) != ErrNoMetadata { + if _, ok := err.(*ErrProtectorNotFound); !ok { t.Fatal(err) } -- cgit v1.3