fix: resolve komga api errors

This commit is contained in:
2026-02-27 09:02:11 +01:00
parent 034aa69f8d
commit b9c8b05bc8
3 changed files with 14253 additions and 2 deletions

14248
komga-openapi.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,9 @@ export async function GET(
} catch (error) { } catch (error) {
logger.error({ err: error }, "API Books - Erreur:"); logger.error({ err: error }, "API Books - Erreur:");
if (error instanceof AppError) { if (error instanceof AppError) {
const isNotFound =
error.code === ERROR_CODES.BOOK.NOT_FOUND ||
(error.code === ERROR_CODES.KOMGA.HTTP_ERROR && (error as any).params?.status === 404);
return NextResponse.json( return NextResponse.json(
{ {
error: { error: {
@@ -29,7 +32,7 @@ export async function GET(
message: getErrorMessage(error.code), message: getErrorMessage(error.code),
} as AppError, } as AppError,
}, },
{ status: 500 } { status: isNotFound ? 404 : 500 }
); );
} }
return NextResponse.json( return NextResponse.json(

View File

@@ -33,7 +33,7 @@ export class BookService extends BaseApiService {
if ( if (
error instanceof AppError && error instanceof AppError &&
error.code === ERROR_CODES.KOMGA.HTTP_ERROR && error.code === ERROR_CODES.KOMGA.HTTP_ERROR &&
(error as any).context?.status === 404 (error as any).params?.status === 404
) { ) {
return null; return null;
} }