fix: resolve komga api errors
This commit is contained in:
14248
komga-openapi.json
Normal file
14248
komga-openapi.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,9 @@ export async function GET(
|
||||
} catch (error) {
|
||||
logger.error({ err: error }, "API Books - Erreur:");
|
||||
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(
|
||||
{
|
||||
error: {
|
||||
@@ -29,7 +32,7 @@ export async function GET(
|
||||
message: getErrorMessage(error.code),
|
||||
} as AppError,
|
||||
},
|
||||
{ status: 500 }
|
||||
{ status: isNotFound ? 404 : 500 }
|
||||
);
|
||||
}
|
||||
return NextResponse.json(
|
||||
|
||||
@@ -33,7 +33,7 @@ export class BookService extends BaseApiService {
|
||||
if (
|
||||
error instanceof AppError &&
|
||||
error.code === ERROR_CODES.KOMGA.HTTP_ERROR &&
|
||||
(error as any).context?.status === 404
|
||||
(error as any).params?.status === 404
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user