Replace error throw with console error and return null for missing announcement by code
This commit is contained in:
parent
43f3c99185
commit
7a1f4ade54
1 changed files with 2 additions and 4 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue