Skip to content

Commit

Permalink
Suppress 'no campaign' errors on pixel view registration. Closes #1588.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Dec 7, 2023
1 parent 95dabe5 commit b6922b0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/core/campaigns.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ func (c *Core) GetCampaignAnalyticsLinks(campIDs []int, typ, fromDate, toDate st
// RegisterCampaignView registers a subscriber's view on a campaign.
func (c *Core) RegisterCampaignView(campUUID, subUUID string) error {
if _, err := c.q.RegisterCampaignView.Exec(campUUID, subUUID); err != nil {
if pqErr, ok := err.(*pq.Error); ok && pqErr.Column == "campaign_id" {
return nil
}

c.log.Printf("error registering campaign view: %s", err)
return echo.NewHTTPError(http.StatusInternalServerError,
c.i18n.Ts("globals.messages.errorUpdating", "name", "{globals.terms.campaign}", "error", pqErrMsg(err)))
Expand Down

0 comments on commit b6922b0

Please sign in to comment.