Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix JSON error on HTML form subscription

Kailash Nadh69d3e9b9c8bc
diff --git a/public.go b/public.go
index 27ba5be5..3c16c04b 100644
--- a/public.go
+++ b/public.go
@@ -3,6 +3,7 @@ package main
import (
"bytes"
"database/sql"
+ "fmt"
"html/template"
"image"
"image/png"
@@ -268,7 +269,8 @@ func handleSubscriptionForm(c echo.Context) error {
req.Status = models.SubscriberStatusEnabled
req.ListUUIDs = pq.StringArray(req.SubListUUIDs)
if _, err := insertSubscriber(req.SubReq, app); err != nil {
- return err
+ return c.Render(http.StatusInternalServerError, tplMessage,
+ makeMsgTpl("Error", "", fmt.Sprintf("%s", err.(*echo.HTTPError).Message)))
}
return c.Render(http.StatusInternalServerError, tplMessage,