mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-10 00:30:29 +01:00
include exit log message in notification
This commit is contained in:
parent
af3e69b7a8
commit
59660ec5c7
@ -155,7 +155,7 @@ func newScript() (*script, error) {
|
||||
"Failure running docker-volume-backup at %s", start.Format(time.RFC3339),
|
||||
)
|
||||
body := fmt.Sprintf(
|
||||
"Running docker-volume-backup failed with error: %s\n\nLog output before the error occurred:\n\n%s\n", err, logOutput,
|
||||
"Running docker-volume-backup failed with error: %s\n\nLog output of the failed run was:\n\n%s\n", err, logOutput,
|
||||
)
|
||||
|
||||
message := gomail.NewMessage()
|
||||
@ -509,12 +509,13 @@ func (s *script) pruneOldBackups() error {
|
||||
// will be called, passing the failure and previous log output.
|
||||
func (s *script) must(err error) {
|
||||
if err != nil {
|
||||
s.logger.Errorf("Fatal error running backup: %s", err)
|
||||
for _, hook := range s.errorHooks {
|
||||
if hookErr := hook(err, s.start, s.output.String()); hookErr != nil {
|
||||
s.logger.Errorf("An error occurred calling an error hook: %s", hookErr)
|
||||
}
|
||||
}
|
||||
s.logger.Fatalf("Fatal error running backup: %s", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user