From 087c770161820b66ca7d0917e9d43e1807db46a0 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Wed, 10 Jun 2020 20:58:56 +0200 Subject: [PATCH] Revive hint to the unlock command if a repository is locked errors.Fatalf wraps a error and just keeps an error message as a string. This prevents the `restic.IsAlreadyLocked(err)` check from working as the error is no longer an ErrAlreadyLocked. Just add an additional remark to the error using `errors.WithMessage`. --- cmd/restic/lock.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/restic/lock.go b/cmd/restic/lock.go index 72a818d9a..d267bc54e 100644 --- a/cmd/restic/lock.go +++ b/cmd/restic/lock.go @@ -36,7 +36,7 @@ func lockRepository(repo *repository.Repository, exclusive bool) (*restic.Lock, lock, err := lockFn(context.TODO(), repo) if err != nil { - return nil, errors.Fatalf("unable to create lock in backend: %v", err) + return nil, errors.WithMessage(err, "unable to create lock in backend") } debug.Log("create lock %p (exclusive %v)", lock, exclusive)