Improve logged stacktraces

This commit is contained in:
Matthew Penner
2020-12-27 13:55:58 -07:00
parent b26db99ee7
commit 3a7c4822f8
4 changed files with 77 additions and 19 deletions

View File

@@ -64,16 +64,13 @@ func (s *Server) Backup(b backup.BackupInterface) error {
ad, err := b.Generate(s.Filesystem().Path(), ignored)
if err != nil {
if notifyError := s.notifyPanelOfBackup(b.Identifier(), &backup.ArchiveDetails{}, false); notifyError != nil {
s.Log().WithFields(log.Fields{
"backup": b.Identifier(),
"error": notifyError,
}).Warn("failed to notify panel of failed backup state")
} else {
if err := s.notifyPanelOfBackup(b.Identifier(), &backup.ArchiveDetails{}, false); err != nil {
s.Log().WithFields(log.Fields{
"backup": b.Identifier(),
"error": err,
}).Info("notified panel of failed backup state")
}).Warn("failed to notify panel of failed backup state")
} else {
s.Log().WithField("backup", b.Identifier()).Info("notified panel of failed backup state")
}
_ = s.Events().PublishJson(BackupCompletedEvent+":"+b.Identifier(), map[string]interface{}{
@@ -84,7 +81,7 @@ func (s *Server) Backup(b backup.BackupInterface) error {
"file_size": 0,
})
return errors.WithMessage(err, "backup: error while generating server backup")
return errors.WrapIf(err, "backup: error while generating server backup")
}
// Try to notify the panel about the status of this backup. If for some reason this request