mirror of
https://github.com/octoleo/restic.git
synced 2024-11-14 17:24:10 +00:00
vss: Change ErrorHandler
signature
We don't need `error` here: the only existing implementation of `ErrorHandler` always call `Backup.Error` and all implementations of `Backup.Error` always return nil.
This commit is contained in:
parent
9d3d915e2c
commit
88c509e3e9
@ -556,8 +556,8 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
errorHandler := func(item string, err error) error {
|
errorHandler := func(item string, err error) {
|
||||||
return progressReporter.Error(item, err)
|
_ = progressReporter.Error(item, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
messageHandler := func(msg string, args ...interface{}) {
|
messageHandler := func(msg string, args ...interface{}) {
|
||||||
|
@ -43,8 +43,8 @@ func ParseVSSConfig(o options.Options) (VSSConfig, error) {
|
|||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrorHandler is used to report errors via callback
|
// ErrorHandler is used to report errors via callback.
|
||||||
type ErrorHandler func(item string, err error) error
|
type ErrorHandler func(item string, err error)
|
||||||
|
|
||||||
// MessageHandler is used to report errors/messages via callbacks.
|
// MessageHandler is used to report errors/messages via callbacks.
|
||||||
type MessageHandler func(msg string, args ...interface{})
|
type MessageHandler func(msg string, args ...interface{})
|
||||||
@ -114,7 +114,7 @@ func (fs *LocalVss) DeleteSnapshots() {
|
|||||||
|
|
||||||
for volumeName, snapshot := range fs.snapshots {
|
for volumeName, snapshot := range fs.snapshots {
|
||||||
if err := snapshot.Delete(); err != nil {
|
if err := snapshot.Delete(); err != nil {
|
||||||
_ = fs.msgError(volumeName, errors.Errorf("failed to delete VSS snapshot: %s", err))
|
fs.msgError(volumeName, errors.Errorf("failed to delete VSS snapshot: %s", err))
|
||||||
activeSnapshots[volumeName] = snapshot
|
activeSnapshots[volumeName] = snapshot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,10 +88,8 @@ func TestVSSConfig(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
errorHandler := func(item string, err error) error {
|
errorHandler := func(item string, err error) {
|
||||||
t.Fatalf("unexpected error (%v)", err)
|
t.Fatalf("unexpected error (%v)", err)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
messageHandler := func(msg string, args ...interface{}) {
|
messageHandler := func(msg string, args ...interface{}) {
|
||||||
t.Fatalf("unexpected message (%s)", fmt.Sprintf(msg, args))
|
t.Fatalf("unexpected message (%s)", fmt.Sprintf(msg, args))
|
||||||
@ -181,10 +179,8 @@ func TestParseMountPoints(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var log []string
|
var log []string
|
||||||
errorHandler := func(item string, err error) error {
|
errorHandler := func(item string, err error) {
|
||||||
log = append(log, strings.TrimSpace(err.Error()))
|
log = append(log, strings.TrimSpace(err.Error()))
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
messageHandler := func(msg string, args ...interface{}) {
|
messageHandler := func(msg string, args ...interface{}) {
|
||||||
t.Fatalf("unexpected message (%s)", fmt.Sprintf(msg, args))
|
t.Fatalf("unexpected message (%s)", fmt.Sprintf(msg, args))
|
||||||
|
Loading…
Reference in New Issue
Block a user