diff --git a/apps/infoalloggi/src/server/controllers/annunci.controller.ts b/apps/infoalloggi/src/server/controllers/annunci.controller.ts index d80c070..72b4899 100644 --- a/apps/infoalloggi/src/server/controllers/annunci.controller.ts +++ b/apps/infoalloggi/src/server/controllers/annunci.controller.ts @@ -33,10 +33,10 @@ export const getAnnunciListHandler = async (): Promise< "stato", ]) .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore query getAllRaw", + message: "Errore query getAllRaw: " + (e as Error).message, }); } }; @@ -54,10 +54,10 @@ export const getCodici_AnnunciHandler = async (): Promise => { } return codici.map((c) => c.codice); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore query getCodici", + message: "Errore query getCodici: " + (e as Error).message, }); } }; @@ -80,10 +80,10 @@ export const getAnnunciByCod = async ({ } return AnnuncioObjectWithImages(annuncio); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore query getAnnuncio", + message: "Errore query getAnnuncio: " + (e as Error).message, }); } }; @@ -108,10 +108,10 @@ export const getAnnunciMetaByCod = async ({ cod }: { cod: string }) => { description: annuncio.desc_it || "", ogUrl: env.NEXT_PUBLIC_BASE_URL + "/annuncio/" + cod, }; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore query getAnnuncio", + message: "Errore query getAnnuncio: " + (e as Error).message, }); } }; @@ -135,10 +135,10 @@ export const getAnnunciById = async ({ } return AnnuncioObjectWithImages(annuncio); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore query getAnnuncioById", + message: "Errore query getAnnuncioById : " + (e as Error).message, }); } }; @@ -314,10 +314,10 @@ export const getCursor_AnnunciHandler = async ({ annunci, hasMore, }; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore query getWithCursor", + message: "Errore query getWithCursor: " + (e as Error).message, }); } }; @@ -344,10 +344,10 @@ export const getOptions_AnnunciHandler = async () => { } return results; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore query getComuni", + message: "Errore query getComuni: " + (e as Error).message, }); } }; @@ -384,10 +384,10 @@ export const editAnnuncioHandler = async ({ .where("id", "=", annuncioId) .execute(); return true; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore interno", + message: "Errore interno: " + (e as Error).message, }); } };