fix: handle missing Komga configuration gracefully by returning an empty array instead of an error in API routes
This commit is contained in:
@@ -29,6 +29,12 @@ export async function GET() {
|
||||
|
||||
return NextResponse.json(validFavoriteIds);
|
||||
} catch (error) {
|
||||
if (error instanceof AppError) {
|
||||
// Si la config Komga n'existe pas, retourner un tableau vide au lieu d'une erreur
|
||||
if (error.code === ERROR_CODES.KOMGA.MISSING_CONFIG) {
|
||||
return NextResponse.json([]);
|
||||
}
|
||||
}
|
||||
console.error("Erreur lors de la récupération des favoris:", error);
|
||||
if (error instanceof AppError) {
|
||||
return NextResponse.json(
|
||||
|
||||
@@ -11,6 +11,12 @@ export async function GET() {
|
||||
const libraries: KomgaLibrary[] = await LibraryService.getLibraries();
|
||||
return NextResponse.json(libraries);
|
||||
} catch (error) {
|
||||
if (error instanceof AppError) {
|
||||
// Si la config Komga n'existe pas, retourner un tableau vide au lieu d'une erreur
|
||||
if (error.code === ERROR_CODES.KOMGA.MISSING_CONFIG) {
|
||||
return NextResponse.json([]);
|
||||
}
|
||||
}
|
||||
console.error("API Libraries - Erreur:", error);
|
||||
if (error instanceof AppError) {
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in New Issue
Block a user