Correctly report backup API errors; ref pterodactyl/panel#2271

This commit is contained in:
Dane Everitt 2020-08-27 19:35:57 -07:00
parent 5f1ceeff90
commit a7ca6b2e34
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 4 additions and 6 deletions

View File

@ -144,7 +144,7 @@ type RequestError struct {
// Returns the error response in a string form that can be more easily consumed.
func (re *RequestError) Error() string {
return fmt.Sprintf("%s: %s (HTTP/%s)", re.Code, re.Detail, re.Status)
return fmt.Sprintf("Error response from Panel: %s: %s (HTTP/%s)", re.Code, re.Detail, re.Status)
}
func (re *RequestError) String() string {

View File

@ -20,13 +20,11 @@ func (s *Server) notifyPanelOfBackup(uuid string, ad *backup.ArchiveDetails, suc
s.Log().WithFields(log.Fields{
"backup": uuid,
"error": err,
}).Error("failed to notify panel of backup status due to internal code error")
}).Error("failed to notify panel of backup status due to wings error")
return err
}
s.Log().WithField("backup", uuid).Warn(rerr.String())
return errors.New(rerr.String())
}
@ -90,7 +88,7 @@ func (s *Server) Backup(b backup.BackupInterface) error {
if notifyError := s.notifyPanelOfBackup(b.Identifier(), &backup.ArchiveDetails{}, false); notifyError != nil {
s.Log().WithFields(log.Fields{
"backup": b.Identifier(),
"error": err,
"error": notifyError,
}).Warn("failed to notify panel of failed backup state")
}
@ -102,7 +100,7 @@ func (s *Server) Backup(b backup.BackupInterface) error {
"file_size": 0,
})
return errors.WithStack(err)
return errors.Wrap(err, "error while generating server backup")
}
// Try to notify the panel about the status of this backup. If for some reason this request