1
0
mirror of https://github.com/offen/docker-volume-backup.git synced 2025-11-23 21:44:40 +02:00

Auto prepend caller when wrapping errors

This commit is contained in:
Frederik Ring
2024-02-16 15:35:42 +01:00
parent 83fa0aae48
commit 52c22a1891
24 changed files with 313 additions and 222 deletions

View File

@@ -5,8 +5,9 @@ package main
import (
"errors"
"fmt"
"sort"
"github.com/offen/docker-volume-backup/internal/errwrap"
)
// hook contains a queued action that can be trigger them when the script
@@ -47,7 +48,7 @@ func (s *script) runHooks(err error) error {
continue
}
if actionErr := hook.action(err); actionErr != nil {
actionErrors = append(actionErrors, fmt.Errorf("runHooks: error running hook: %w", actionErr))
actionErrors = append(actionErrors, errwrap.Wrap(actionErr, "error running hook"))
}
}
if len(actionErrors) != 0 {