mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 04:45:15 +00:00
errors: Drop WithMessage
This commit is contained in:
parent
1a6160d152
commit
ba44666704
@ -457,7 +457,7 @@ func collectTargets(opts BackupOptions, args []string) (targets []string, err er
|
|||||||
var expanded []string
|
var expanded []string
|
||||||
expanded, err := filepath.Glob(line)
|
expanded, err := filepath.Glob(line)
|
||||||
if err != nil {
|
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 {
|
if len(expanded) == 0 {
|
||||||
Warnf("pattern %q does not match any files, skipping\n", line)
|
Warnf("pattern %q does not match any files, skipping\n", line)
|
||||||
|
@ -2,11 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/debug"
|
"github.com/restic/restic/internal/debug"
|
||||||
"github.com/restic/restic/internal/errors"
|
|
||||||
"github.com/restic/restic/internal/restic"
|
"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)
|
lock, err := lockFn(ctx, repo)
|
||||||
if err != nil {
|
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)
|
debug.Log("create lock %p (exclusive %v)", lock, exclusive)
|
||||||
|
|
||||||
|
@ -22,10 +22,6 @@ var Wrap = errors.Wrap
|
|||||||
// nil, Wrapf returns nil.
|
// nil, Wrapf returns nil.
|
||||||
var Wrapf = errors.Wrapf
|
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
|
var WithStack = errors.WithStack
|
||||||
|
|
||||||
// Go 1.13-style error handling.
|
// Go 1.13-style error handling.
|
||||||
|
Loading…
Reference in New Issue
Block a user