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`.
This commit is contained in:
Michael Eischer 2020-06-10 20:58:56 +02:00
parent 6856d1e422
commit 087c770161
1 changed files with 1 additions and 1 deletions

View File

@ -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)