diff --git a/src/app/books/[bookId]/page.tsx b/src/app/books/[bookId]/page.tsx
index 8f86dcf..1abb12d 100644
--- a/src/app/books/[bookId]/page.tsx
+++ b/src/app/books/[bookId]/page.tsx
@@ -7,6 +7,7 @@ import { withPageTiming } from "@/lib/hoc/withPageTiming";
import { KomgaBookWithPages } from "@/types/komga";
import { ErrorMessage } from "@/components/ui/ErrorMessage";
import { ERROR_CODES } from "@/constants/errorCodes";
+import { AppError } from "@/utils/errors";
async function BookPage({ params }: { params: { bookId: string } }) {
try {
@@ -19,6 +20,13 @@ async function BookPage({ params }: { params: { bookId: string } }) {
);
} catch (error) {
console.error("Erreur:", error);
+ if (error instanceof AppError) {
+ return (
+
+
+
+ );
+ }
return (
diff --git a/src/app/libraries/[libraryId]/page.tsx b/src/app/libraries/[libraryId]/page.tsx
index 04fc2a8..2f4edc7 100644
--- a/src/app/libraries/[libraryId]/page.tsx
+++ b/src/app/libraries/[libraryId]/page.tsx
@@ -9,6 +9,7 @@ import { LibraryResponse } from "@/types/library";
import { KomgaSeries, KomgaLibrary } from "@/types/komga";
import { UserPreferences } from "@/types/preferences";
import { ERROR_CODES } from "@/constants/errorCodes";
+import { AppError } from "@/utils/errors";
interface PageProps {
params: { libraryId: string };
@@ -51,7 +52,7 @@ async function getLibrarySeries(
return { data: series, library };
} catch (error) {
- throw error instanceof Error ? error : new Error("Erreur lors de la récupération des séries");
+ throw error instanceof Error ? error : new AppError(ERROR_CODES.SERIES.FETCH_ERROR, {}, error);
}
}
@@ -92,14 +93,14 @@ async function LibraryPage({ params, searchParams }: PageProps) {
);
} catch (error) {
- if (error instanceof Error) {
+ if (error instanceof AppError) {
return (
);
}
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 4b2ae32..04e8138 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -30,6 +30,13 @@ async function HomePage() {
if (error instanceof AppError && error.code === ERROR_CODES.KOMGA.MISSING_CONFIG) {
redirect("/settings");
}
+ if (error instanceof AppError) {
+ return (
+
+
+
+ );
+ }
return (
diff --git a/src/app/series/[seriesId]/page.tsx b/src/app/series/[seriesId]/page.tsx
index 57eb5cc..c6361f7 100644
--- a/src/app/series/[seriesId]/page.tsx
+++ b/src/app/series/[seriesId]/page.tsx
@@ -9,6 +9,7 @@ import { LibraryResponse } from "@/types/library";
import { KomgaBook, KomgaSeries } from "@/types/komga";
import { UserPreferences } from "@/types/preferences";
import { ERROR_CODES } from "@/constants/errorCodes";
+import { AppError } from "@/utils/errors";
interface PageProps {
params: { seriesId: string };
@@ -76,6 +77,13 @@ async function SeriesPage({ params, searchParams }: PageProps) {
);
} catch (error) {
+ if (error instanceof AppError) {
+ return (
+
+
+
+ );
+ }
return (
Série
diff --git a/src/components/auth/LoginForm.tsx b/src/components/auth/LoginForm.tsx
index 44c94a6..a020a42 100644
--- a/src/components/auth/LoginForm.tsx
+++ b/src/components/auth/LoginForm.tsx
@@ -6,6 +6,7 @@ import { authService } from "@/lib/services/auth.service";
import { AppErrorType } from "@/types/global";
import { ErrorMessage } from "@/components/ui/ErrorMessage";
import { useTranslate } from "@/hooks/useTranslate";
+import { AppError } from "@/utils/errors";
interface LoginFormProps {
from?: string;
@@ -89,7 +90,7 @@ export function LoginForm({ from }: LoginFormProps) {
{t("login.form.remember")}
- {error && }
+ {error && error instanceof AppError && }
- {error && }
+ {error && error instanceof AppError && }