···
···
func (h *Handler) HandleNotificationFeed(w http.ResponseWriter, r *http.Request) {
14
+
l := h.Logger.With("handler", "HandleNotificationFeed")
user, err := bsky.GetUserWithBskyProfile(h.Oauth, r)
17
-
log.Println("failed to get logged-in user:", err)
18
+
l.Error("failed to get logged-in user", "err", err)
htmx.HxRedirect(w, "/login")
···
page, err := strconv.ParseInt(pageStr, 10, 64)
28
-
log.Println("failed to parse page value:", err)
29
+
l.Error("failed to parse page value", "err", err)
···
notifications, err := db.GetNotificationsByDid(h.Db, user.Did, pageSize+1, int(offset))
42
-
log.Println("failed to retrieve notifications:", err)
43
+
l.Error("failed to retrieve notifications", "err", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to get notifications, try again later.")
hydratedNotifications, err := h.getBskyProfileHydratedNotificationFeed(notifications)
49
-
log.Println("failed to hydrate notifications with bsky profile:", err)
50
+
l.Error("failed to hydrate notifications with bsky profile", "err", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to get notifications, try again later.")
···
func (h *Handler) HandleNotificationMarkAllRead(w http.ResponseWriter, r *http.Request) {
70
+
l := h.Logger.With("handler", "HandleNotificationMarkAllRead")
user, err := bsky.GetUserWithBskyProfile(h.Oauth, r)
71
-
log.Println("failed to get logged-in user:", err)
74
+
l.Error("failed to get logged-in user", "err", err)
htmx.HxRedirect(w, "/login")
err = db.MarkAllNotificationsAsRead(h.Db, user.Did)
78
-
log.Println("failed to mark all notifications:", err)
81
+
l.Error("failed to mark all notifications", "err", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to mark all notifications as read, try again later.")