From 7a1f4ade54f5c1190cc6d5f0f6e90bd78fed6e02 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Tue, 19 Aug 2025 14:00:09 +0200 Subject: [PATCH] Replace error throw with console error and return null for missing announcement by code --- .../src/server/controllers/annunci.controller.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/infoalloggi/src/server/controllers/annunci.controller.ts b/apps/infoalloggi/src/server/controllers/annunci.controller.ts index 6920300..d80c070 100644 --- a/apps/infoalloggi/src/server/controllers/annunci.controller.ts +++ b/apps/infoalloggi/src/server/controllers/annunci.controller.ts @@ -75,10 +75,8 @@ export const getAnnunciByCod = async ({ .where("codice", "=", cod) .executeTakeFirst(); if (!annuncio) { - throw new TRPCError({ - code: "NOT_FOUND", - message: "Annuncio non trovato", - }); + console.error("Annuncio non trovato per codice:", cod); + return null; } return AnnuncioObjectWithImages(annuncio);