fix: reduce unauthenticated log noise and add request path context
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m46s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m46s
This commit is contained in:
@@ -4,7 +4,10 @@ import type { KomgaSeries } from "@/types/komga";
|
||||
import logger from "@/lib/logger";
|
||||
|
||||
export class FavoritesService {
|
||||
static async getFavorites(): Promise<KomgaSeries[]> {
|
||||
static async getFavorites(context?: {
|
||||
requestPath?: string;
|
||||
requestPathname?: string;
|
||||
}): Promise<KomgaSeries[]> {
|
||||
try {
|
||||
const favoriteIds = await FavoriteService.getAllFavoriteIds();
|
||||
|
||||
@@ -17,7 +20,15 @@ export class FavoritesService {
|
||||
try {
|
||||
return await SeriesService.getSeries(id);
|
||||
} catch (error) {
|
||||
logger.error({ err: error, seriesId: id }, "Error fetching favorite series");
|
||||
logger.error(
|
||||
{
|
||||
err: error,
|
||||
seriesId: id,
|
||||
requestPath: context?.requestPath,
|
||||
requestPathname: context?.requestPathname,
|
||||
},
|
||||
"Error fetching favorite series"
|
||||
);
|
||||
// Si la série n'existe plus, la retirer des favoris
|
||||
try {
|
||||
await FavoriteService.removeFromFavorites(id);
|
||||
@@ -31,9 +42,15 @@ export class FavoritesService {
|
||||
const results = await Promise.all(promises);
|
||||
return results.filter((series): series is KomgaSeries => series !== null);
|
||||
} catch (error) {
|
||||
logger.error({ err: error }, "Error fetching favorites");
|
||||
logger.error(
|
||||
{
|
||||
err: error,
|
||||
requestPath: context?.requestPath,
|
||||
requestPathname: context?.requestPathname,
|
||||
},
|
||||
"Error fetching favorites"
|
||||
);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user