From 5bef143fdbbbc2a91abee2e9a873287cbe836126 Mon Sep 17 00:00:00 2001 From: Michael Reber Date: Fri, 20 Feb 2026 15:30:53 +0100 Subject: [PATCH] Return better information on JSON parsing errors, that no action is recorded in that case --- pkg/web/handlers.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/web/handlers.go b/pkg/web/handlers.go index 77005dd..133c0d7 100644 --- a/pkg/web/handlers.go +++ b/pkg/web/handlers.go @@ -292,7 +292,7 @@ func BanNotificationHandler(c *gin.Context) { log.Printf("❌ Validation error: Field '%s' violated rule '%s'", fe.Field(), fe.ActualTag()) } } else { - log.Printf("❌ JSON parsing error: %v", err) + log.Printf("❌ JSON parsing error -> Action will not be recorded! Details: %v", err) } log.Printf("Raw JSON: %s", string(body)) c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request: " + err.Error()}) @@ -361,7 +361,7 @@ func UnbanNotificationHandler(c *gin.Context) { log.Printf("❌ Validation error: Field '%s' violated rule '%s'", fe.Field(), fe.ActualTag()) } } else { - log.Printf("❌ JSON parsing error: %v", err) + log.Printf("❌ JSON parsing error -> Action will not be recorded! Details: %v", err) } log.Printf("Raw JSON: %s", string(body)) c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request: " + err.Error()}) @@ -2448,7 +2448,6 @@ func getEmailStyle() string { return "modern" } - // Connects to the SMTP server and delivers a single HTML message. func sendEmail(to, subject, body string, settings config.AppSettings) error { // Skips sending if the destination email is still the default placeholder