From f78515cc07a70e8e89c3b7a27f4ed6b72737b307 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Mon, 9 Feb 2026 22:34:07 +0000 Subject: [PATCH] Fix error log reporting --- platform/report/report_nuisance.go | 4 ++-- rmo/notification.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/report/report_nuisance.go b/platform/report/report_nuisance.go index 89372491..9e65f503 100644 --- a/platform/report/report_nuisance.go +++ b/platform/report/report_nuisance.go @@ -42,7 +42,7 @@ func (sr Nuisance) addNotificationEmail(ctx context.Context, txn bob.Tx, email s } _, err := models.PublicreportNotifyPhoneNuisances.Insert(&setter).Exec(ctx, txn) if err != nil { - return newErrorWithCode("internal-error", "Failed to save new notification row") + return newErrorWithCode("internal-error", "Failed to save new notification email row") } return nil } @@ -56,7 +56,7 @@ func (sr Nuisance) addNotificationPhone(ctx context.Context, txn bob.Tx, phone t } _, err = models.PublicreportNotifyPhoneNuisances.Insert(&setter).Exec(ctx, txn) if err != nil { - return newErrorWithCode("internal-error", "Failed to save new notification row") + return newErrorWithCode("internal-error", "Failed to save new notification phone row") } return nil } diff --git a/rmo/notification.go b/rmo/notification.go index 9027db1d..5da2d635 100644 --- a/rmo/notification.go +++ b/rmo/notification.go @@ -42,6 +42,7 @@ func postRegisterNotifications(w http.ResponseWriter, r *http.Request) { } e := report.SaveReporter(ctx, txn, report_id, name, email, phone, has_consent) if e != nil { + log.Error().Err(e).Str("name", name).Msg("Failed to save reporter") http.Redirect(w, r, fmt.Sprintf("/error?code=%s&report=%s", e.Code(), report_id), http.StatusFound) return } @@ -49,12 +50,14 @@ func postRegisterNotifications(w http.ResponseWriter, r *http.Request) { if has_subscribe { e := report.RegisterSubscriptionEmail(ctx, txn, email) if e != nil { + log.Error().Err(e).Str("email", email).Msg("Failed to register subscription email") http.Redirect(w, r, fmt.Sprintf("/error?code=%s&report=%s", e.Code(), report_id), http.StatusFound) } } if has_notification { e := report.RegisterNotificationEmail(ctx, txn, report_id, email) if e != nil { + log.Error().Err(e).Str("email", email).Msg("Failed to register notification email") http.Redirect(w, r, fmt.Sprintf("/error?code=%s&report=%s", e.Code(), report_id), http.StatusFound) } } @@ -63,12 +66,14 @@ func postRegisterNotifications(w http.ResponseWriter, r *http.Request) { if has_subscribe { e := report.RegisterSubscriptionPhone(ctx, txn, *phone) if e != nil { + log.Error().Err(e).Str("phone", phone_str).Msg("Failed to register subscription phone") http.Redirect(w, r, fmt.Sprintf("/error?code=%s&report=%s", e.Code(), report_id), http.StatusFound) } } if has_notification { e := report.RegisterNotificationPhone(ctx, txn, report_id, *phone) if e != nil { + log.Error().Err(e).Str("phone", phone_str).Msg("Failed to register notification phone") http.Redirect(w, r, fmt.Sprintf("/error?code=%s&report=%s", e.Code(), report_id), http.StatusFound) } }