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)
.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<typeof annuncio>(annuncio);