feat: enhance error handling in prepareMatchingContext with logging for category loading issues
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-09 16:07:22 +02:00
parent b121000bf7
commit d2f651fa2c
@@ -174,9 +174,17 @@ export class ReceiptImportService {
let categories: Awaited<ReturnType<CategoriesService['findFlattened']>>;
try {
categories = await this.categoriesService.findFlattened();
} catch {
} catch (err) {
this.logger.warn(
`prepareMatchingContext: kunde inte ladda kategorier (${String(err)}). Kategori-förslag kan utebli.`,
);
categories = [];
}
if (categories.length === 0) {
this.logger.warn(
'prepareMatchingContext: inga kategorier laddade. Regel-baserade kategori-förslag blir tomma.',
);
}
const [aliases, products, unitMappings] = await Promise.all([
this.prisma.receiptAlias.findMany({