feat: enhance error handling in prepareMatchingContext with logging for category loading issues
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user