Browse Source

Fixing issues - get values from non objects (#1773)

After calls to get Template, Page, and SMTP, if the objects aren't found then we're currently trying to display error message using the name values of the non objects. This changes this behavior such that we use the name values from the campaign object to give better log messages.
pull/1785/head
Jordan Wright 1 year ago
committed by GitHub
parent
commit
6251ea6a02
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      models/campaign.go

+ 3
- 3
models/campaign.go View File

@ -491,7 +491,7 @@ func PostCampaign(c *Campaign, uid int64) error {
t, err := GetTemplateByName(c.Template.Name, uid)
if err == gorm.ErrRecordNotFound {
log.WithFields(logrus.Fields{
"template": t.Name,
"template": c.Template.Name,
}).Error("Template does not exist")
return ErrTemplateNotFound
} else if err != nil {
@ -504,7 +504,7 @@ func PostCampaign(c *Campaign, uid int64) error {
p, err := GetPageByName(c.Page.Name, uid)
if err == gorm.ErrRecordNotFound {
log.WithFields(logrus.Fields{
"page": p.Name,
"page": c.Page.Name,
}).Error("Page does not exist")
return ErrPageNotFound
} else if err != nil {
@ -517,7 +517,7 @@ func PostCampaign(c *Campaign, uid int64) error {
s, err := GetSMTPByName(c.SMTP.Name, uid)
if err == gorm.ErrRecordNotFound {
log.WithFields(logrus.Fields{
"smtp": s.Name,
"smtp": c.SMTP.Name,
}).Error("Sending profile does not exist")
return ErrSMTPNotFound
} else if err != nil {

Loading…
Cancel
Save