mirror of
https://github.com/offen/docker-volume-backup.git
synced 2025-12-23 17:21:10 +01:00
Fix: send failure notifications for config init errors (#697)
* Register notification hooks first in init to allow sending .init() failure notifications * Error from run_script is not consistently passed to deferred functions --------- Co-authored-by: Frederik Ring <frederik.ring@gmail.com>
This commit is contained in:
@@ -63,11 +63,22 @@ func runScript(c *Config) (err error) {
|
||||
}
|
||||
|
||||
if initErr := s.init(); initErr != nil {
|
||||
if hookErr := s.runHooks(initErr); hookErr != nil {
|
||||
err = errwrap.Wrap(
|
||||
nil,
|
||||
fmt.Sprintf(
|
||||
"error %v instantiating script followed by %v calling the registered hooks",
|
||||
initErr,
|
||||
hookErr,
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
err = errwrap.Wrap(initErr, "error instantiating script")
|
||||
return
|
||||
}
|
||||
|
||||
return func() (err error) {
|
||||
err = func() (err error) {
|
||||
scriptErr := func() error {
|
||||
if err := s.withLabeledCommands(lifecyclePhaseArchive, func() (err error) {
|
||||
restartContainersAndServices, err := s.stopContainersAndServices()
|
||||
@@ -121,4 +132,6 @@ func runScript(c *Config) (err error) {
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user