Replace error throw with console error and return null for missing announcement by code

This commit is contained in:
Marco Pedone 2025-08-19 14:00:09 +02:00
parent 43f3c99185
commit 7a1f4ade54

View file

@ -75,10 +75,8 @@ export const getAnnunciByCod = async ({
.where("codice", "=", cod) .where("codice", "=", cod)
.executeTakeFirst(); .executeTakeFirst();
if (!annuncio) { if (!annuncio) {
throw new TRPCError({ console.error("Annuncio non trovato per codice:", cod);
code: "NOT_FOUND", return null;
message: "Annuncio non trovato",
});
} }
return AnnuncioObjectWithImages<typeof annuncio>(annuncio); return AnnuncioObjectWithImages<typeof annuncio>(annuncio);