forked from TrueCloudLab/restic
errors: Drop WithMessage
This commit is contained in:
parent
1a6160d152
commit
ba44666704
3 changed files with 3 additions and 7 deletions
|
@ -457,7 +457,7 @@ func collectTargets(opts BackupOptions, args []string) (targets []string, err er
|
|||
var expanded []string
|
||||
expanded, err := filepath.Glob(line)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, fmt.Sprintf("pattern: %s", line))
|
||||
return nil, fmt.Errorf("pattern: %s: %w", line, err)
|
||||
}
|
||||
if len(expanded) == 0 {
|
||||
Warnf("pattern %q does not match any files, skipping\n", line)
|
||||
|
|
|
@ -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, errors.WithMessage(err, "unable to create lock in backend")
|
||||
return nil, ctx, fmt.Errorf("unable to create lock in backend: %w", err)
|
||||
}
|
||||
debug.Log("create lock %p (exclusive %v)", lock, exclusive)
|
||||
|
||||
|
|
|
@ -22,10 +22,6 @@ var Wrap = errors.Wrap
|
|||
// nil, Wrapf returns nil.
|
||||
var Wrapf = errors.Wrapf
|
||||
|
||||
// WithMessage annotates err with a new message. If err is nil, WithMessage
|
||||
// returns nil.
|
||||
var WithMessage = errors.WithMessage
|
||||
|
||||
var WithStack = errors.WithStack
|
||||
|
||||
// Go 1.13-style error handling.
|
||||
|
|
Loading…
Reference in a new issue