From c995b5be528db2830fa06e9ab376de34daf05580 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 14 Jan 2023 17:38:20 +0100 Subject: [PATCH] lock: cleanup error message The error message is now `Fatal: unable to create lock in backend: [...]` instead of `unable to create lock in backend: Fatal: [...]`. --- cmd/restic/lock.go | 4 ++-- internal/restic/lock.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/restic/lock.go b/cmd/restic/lock.go index e15d63b8d..ea230fa7a 100644 --- a/cmd/restic/lock.go +++ b/cmd/restic/lock.go @@ -2,11 +2,11 @@ package main import ( "context" - "fmt" "sync" "time" "github.com/restic/restic/internal/debug" + "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" ) @@ -45,7 +45,7 @@ func lockRepository(ctx context.Context, repo restic.Repository, exclusive bool) lock, err := lockFn(ctx, repo) if err != nil { - return nil, ctx, fmt.Errorf("unable to create lock in backend: %w", err) + return nil, ctx, errors.Fatalf("unable to create lock in backend: %v", err) } debug.Log("create lock %p (exclusive %v)", lock, exclusive) diff --git a/internal/restic/lock.go b/internal/restic/lock.go index 8f49aee49..10271b778 100644 --- a/internal/restic/lock.go +++ b/internal/restic/lock.go @@ -146,7 +146,7 @@ func (l *Lock) checkForOtherLocks(ctx context.Context) error { // if we cannot load a lock then it is unclear whether it can be ignored // it could either be invalid or just unreadable due to network/permission problems debug.Log("ignore lock %v: %v", id, err) - return errors.Fatal(err.Error()) + return err } if l.Exclusive {