diff --git a/static/search/fetch.ts b/static/search/fetch.ts index 0904e7e..8c84004 100644 --- a/static/search/fetch.ts +++ b/static/search/fetch.ts @@ -118,12 +118,13 @@ export const fetchSearchItems = (query: string): void => { responseCache.set(query, response); renderItems(visibleItems); }) - .catch(() => { + .catch((error) => { if (controller.signal.aborted) { return; } setActiveRequestController(undefined); + console.error("search request failed:", error); renderSearchErrorState(query); }); }; @@ -168,8 +169,9 @@ export const fetchNextSearchPage = (): void => { setSearchPagination(response.nextPage, response.hasNextPage); appendItems(visibleItems); }) - .catch(() => { + .catch((error) => { window.showToast?.({ message: "Failed to load more search results." }); + console.error("failed to load more search results:", error); }) .finally(() => { setFetchingNextPage(false); diff --git a/static/search/render.ts b/static/search/render.ts index 7561f30..e739500 100644 --- a/static/search/render.ts +++ b/static/search/render.ts @@ -140,8 +140,9 @@ export const removeContinueWatchingItem = (item: CommandPaletteItem): void => { removeContinueWatchingCard(animeID); renderItems(getResultItems().filter((candidate) => candidate.id !== item.id)); }) - .catch(() => { + .catch((error) => { window.showToast?.({ message: "Failed to remove from Continue Watching." }); + console.error("failed to remove from continue watching:", error); }); }; diff --git a/static/search/state.ts b/static/search/state.ts index d984c8b..19f02aa 100644 --- a/static/search/state.ts +++ b/static/search/state.ts @@ -177,7 +177,8 @@ export const isSafeImageUrl = (rawUrl?: string): boolean => { try { const parsed = new URL(rawUrl, window.location.origin); return parsed.protocol === "https:" || parsed.protocol === "http:"; - } catch { + } catch (error) { + console.error("Failed to validate URL:", error); return false; } };