fix: log anime fetch errors in watch page and thumbnail handlers
This commit is contained in:
@@ -3,13 +3,14 @@ package handler
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"mal/internal/domain"
|
|
||||||
"mal/internal/server"
|
|
||||||
netutil "mal/pkg/net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"mal/internal/domain"
|
||||||
|
"mal/internal/server"
|
||||||
|
netutil "mal/pkg/net"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -53,7 +54,10 @@ func (h *PlaybackHandler) HandleWatchPage(c *gin.Context) {
|
|||||||
|
|
||||||
data, err := h.svc.BuildWatchData(c.Request.Context(), id, []string{}, ep, mode, userID)
|
data, err := h.svc.BuildWatchData(c.Request.Context(), id, []string{}, ep, mode, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
anime, _ := h.animeSvc.GetAnimeByID(c.Request.Context(), id)
|
anime, fetchErr := h.animeSvc.GetAnimeByID(c.Request.Context(), id)
|
||||||
|
if fetchErr != nil {
|
||||||
|
fmt.Printf("error fetching anime for error page: %v\n", fetchErr)
|
||||||
|
}
|
||||||
c.HTML(http.StatusOK, "watch.gohtml", domain.WatchPageData{
|
c.HTML(http.StatusOK, "watch.gohtml", domain.WatchPageData{
|
||||||
Error: err.Error(),
|
Error: err.Error(),
|
||||||
Anime: anime,
|
Anime: anime,
|
||||||
@@ -241,7 +245,10 @@ func (h *PlaybackHandler) HandleEpisodeThumbnails(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
anime, _ := h.animeSvc.GetAnimeByID(c.Request.Context(), id)
|
anime, fetchErr := h.animeSvc.GetAnimeByID(c.Request.Context(), id)
|
||||||
|
if fetchErr != nil {
|
||||||
|
fmt.Printf("error fetching anime for thumbnail fill: %v\n", fetchErr)
|
||||||
|
}
|
||||||
if anime.Episodes > 0 && anime.Episodes > len(allEpisodes) {
|
if anime.Episodes > 0 && anime.Episodes > len(allEpisodes) {
|
||||||
epMap := make(map[int]domain.EpisodeData)
|
epMap := make(map[int]domain.EpisodeData)
|
||||||
for _, ep := range allEpisodes {
|
for _, ep := range allEpisodes {
|
||||||
|
|||||||
Reference in New Issue
Block a user