2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-21 20:35:12 +00:00

errors: Drop WithMessage

This commit is contained in:
greatroar 2022-10-09 11:23:07 +02:00
parent 1a6160d152
commit ba44666704
3 changed files with 3 additions and 7 deletions

View File

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

View File

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

View File

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