diff --git a/apps/infoalloggi/src/server/api/routers/invite.ts b/apps/infoalloggi/src/server/api/routers/invite.ts index 2848151..01e7143 100644 --- a/apps/infoalloggi/src/server/api/routers/invite.ts +++ b/apps/infoalloggi/src/server/api/routers/invite.ts @@ -82,7 +82,7 @@ export const inviteRouter = createTRPCRouter({ if (!user) { throw new TRPCError({ code: "NOT_FOUND", - message: "Utente non trovato", + message: `Accept Invite: Utente non trovato con email: ${input.email}`, }); } const invite = await verifyInviteToken(input.token); @@ -90,7 +90,7 @@ export const inviteRouter = createTRPCRouter({ if (!invite) { throw new TRPCError({ code: "NOT_FOUND", - message: "Invito non valido o scaduto", + message: `Accept Invite: Invito non valido o scaduto per email: ${input.email}`, }); } diff --git a/apps/infoalloggi/src/server/controllers/annunci.controller.ts b/apps/infoalloggi/src/server/controllers/annunci.controller.ts index 510ee26..3b72d18 100644 --- a/apps/infoalloggi/src/server/controllers/annunci.controller.ts +++ b/apps/infoalloggi/src/server/controllers/annunci.controller.ts @@ -49,7 +49,7 @@ export const getAnnunciListHandler = async (): Promise< } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore query getAllRaw: ${(e as Error).message}`, + message: `Errore getAnnunciListHandler: ${(e as Error).message}`, }); } }; @@ -70,7 +70,7 @@ export const getCodici_AnnunciHandler = async (): Promise => { } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore query getCodici: ${(e as Error).message}`, + message: `Errore getCodici_AnnunciHandler: ${(e as Error).message}`, }); } }; diff --git a/apps/infoalloggi/src/server/controllers/auth.controller.ts b/apps/infoalloggi/src/server/controllers/auth.controller.ts index 1405379..d400b95 100644 --- a/apps/infoalloggi/src/server/controllers/auth.controller.ts +++ b/apps/infoalloggi/src/server/controllers/auth.controller.ts @@ -187,7 +187,7 @@ export const swapAuth = async ({ if (!user) { throw new TRPCError({ code: "NOT_FOUND", - message: "Utente non trovato", + message: `Swap: Utente non trovato: ${userId}`, }); } @@ -219,10 +219,10 @@ export const swapAuth = async ({ req, res, }); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore interno", + message: `Errore Swap Auth: ${(e as Error).message}`, }); } }; @@ -267,7 +267,7 @@ export const passwordChange = async ({ if (!dbUser) { throw new TRPCError({ code: "NOT_FOUND", - message: "Utente non trovato", + message: `Password Change: Utente non trovato: ${userId}`, }); } const banned = await isBanned({ data: { email: dbUser.email }, db }); @@ -286,7 +286,7 @@ export const passwordChange = async ({ if (!isPasswordCorrect) { throw new TRPCError({ code: "BAD_REQUEST", - message: "Password errata", + message: `Password Change: Password errata per utente: ${userId}`, }); } diff --git a/apps/infoalloggi/src/server/controllers/etichette.controller.ts b/apps/infoalloggi/src/server/controllers/etichette.controller.ts index 5c15ee9..393eed2 100644 --- a/apps/infoalloggi/src/server/controllers/etichette.controller.ts +++ b/apps/infoalloggi/src/server/controllers/etichette.controller.ts @@ -4,7 +4,14 @@ import type { EtichetteIdEtichetta } from "~/schemas/public/Etichette"; import type { Querier } from "~/server/db"; export const getAllEtichette = async ({ db }: { db: Querier }) => { - return await db.selectFrom("etichette").selectAll().execute(); + try { + return await db.selectFrom("etichette").selectAll().execute(); + } catch (e) { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: `Errore recupero etichette: ${(e as Error).message}`, + }); + } }; export const addEtichetta = async ({ db, @@ -22,10 +29,10 @@ export const addEtichetta = async ({ .returning("id_etichetta") .values({ color_hex, title }) .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore aggiunta etichetta", + message: `Errore aggiunta etichetta: ${(e as Error).message}`, }); } }; @@ -48,10 +55,10 @@ export const updateEtichetta = async ({ .set({ color_hex, title }) .where("id_etichetta", "=", etichettaid) .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore aggiornamento etichetta", + message: `Errore aggiornamento etichetta: ${(e as Error).message}`, }); } }; @@ -69,10 +76,10 @@ export const removeEtichetta = async ({ .where("id_etichetta", "=", etichettaid) .execute(); return "ok"; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore rimozione etichetta", + message: `Errore rimozione etichetta: ${(e as Error).message}`, }); } }; @@ -99,10 +106,10 @@ export const getChatEtichette = async ({ "etichette.color_hex", ]) .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore recupero etichette", + message: `Errore recupero etichette: ${(e as Error).message}`, }); } }; @@ -123,10 +130,10 @@ export const addChatEtichette = async ({ .values({ chatid, etichettaid }) .onConflict((oc) => oc.columns(["chatid", "etichettaid"]).doNothing()) .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore aggiunta etichetta", + message: `Errore aggiunta etichetta: ${(e as Error).message}`, }); } }; @@ -147,10 +154,10 @@ export const removeChatEtichette = async ({ .where("etichettaid", "=", etichettaid) .execute(); return "ok"; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore rimozione etichetta", + message: `Errore rimozione etichetta: ${(e as Error).message}`, }); } }; diff --git a/apps/infoalloggi/src/server/controllers/fic.controller.ts b/apps/infoalloggi/src/server/controllers/fic.controller.ts index bde2eb6..d4e49a3 100644 --- a/apps/infoalloggi/src/server/controllers/fic.controller.ts +++ b/apps/infoalloggi/src/server/controllers/fic.controller.ts @@ -121,7 +121,7 @@ export const exportUserToFIC = async (userId: UsersId) => { console.error("Error exporting user to FIC:", error); throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Failed to export user to Fatture In Cloud", + message: `Failed to export user to Fatture In Cloud: ${(error as Error).message}`, }); } }; diff --git a/apps/infoalloggi/src/server/controllers/pagamenti.controller.ts b/apps/infoalloggi/src/server/controllers/pagamenti.controller.ts index d979f23..108c6a2 100644 --- a/apps/infoalloggi/src/server/controllers/pagamenti.controller.ts +++ b/apps/infoalloggi/src/server/controllers/pagamenti.controller.ts @@ -588,7 +588,7 @@ export const getPacksPerServizio = async ( if (!servizio) { throw new TRPCError({ code: "NOT_FOUND", - message: "Servizio non trovato", + message: `Servizio non trovato - servizioId: ${servizioId}`, }); } return { @@ -608,7 +608,7 @@ export const previewSaldo = async ( if (!servizio) { return { success: false, - message: "Servizio non trovato", + message: `Servizio non trovato - servizioId: ${servizioId}`, }; } const saldo = await SaldoSolver({ diff --git a/apps/infoalloggi/src/server/controllers/servizio.controller.ts b/apps/infoalloggi/src/server/controllers/servizio.controller.ts index 86e87c1..e60d6a3 100644 --- a/apps/infoalloggi/src/server/controllers/servizio.controller.ts +++ b/apps/infoalloggi/src/server/controllers/servizio.controller.ts @@ -43,7 +43,7 @@ export const getDataPerAcquisto = async (servizioId: ServizioServizioId) => { if (!servizio) { throw new TRPCError({ code: "NOT_FOUND", - message: "Servizio not found", + message: `Servizio not found - servizioId: ${servizioId}`, }); } @@ -632,7 +632,7 @@ export const getServizioDataById = async ( if (!data) { throw new TRPCError({ code: "NOT_FOUND", - message: "Servizio not found", + message: `Servizio not found - servizioId: ${servizioId}`, }); } @@ -640,7 +640,7 @@ export const getServizioDataById = async ( } catch (e) { throw new TRPCError({ code: "NOT_FOUND", - message: `Servizio annunci not found: ${(e as Error).message}`, + message: `Servizio annunci not found - servizioId: ${servizioId}: ${(e as Error).message}`, }); } }; @@ -1150,7 +1150,15 @@ export type RichiesteData = Pick< | "isOkConsulenza" | "interruzioneDays" > & - Pick & { + Pick< + Users, + | "nome" + | "username" + | "note" + | "telefono" + | "extra_telefono_numero" + | "extra_telefono_titolo" + > & { annunci_servizio: ServizioAnnuncioData[]; ordini_servizio: Pick< Ordini, @@ -1182,7 +1190,14 @@ export const getRichieste = async (): Promise => { "servizio.isOkConsulenza", "servizio.interruzioneDays", ]) - .select(["users.username", "users.note", "users.telefono"]) + .select([ + "users.nome", + "users.username", + "users.note", + "users.telefono", + "users.extra_telefono_numero", + "users.extra_telefono_titolo", + ]) .select((eb) => [ jsonArrayFrom( eb diff --git a/apps/infoalloggi/src/server/controllers/user.controller.ts b/apps/infoalloggi/src/server/controllers/user.controller.ts index add8e60..3470905 100644 --- a/apps/infoalloggi/src/server/controllers/user.controller.ts +++ b/apps/infoalloggi/src/server/controllers/user.controller.ts @@ -22,10 +22,10 @@ export const editAccountHandler = async ({ .execute(); return "success"; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "errore modifica utente", + message: `errore modifica utente - id: ${id}: ${(e as Error).message}`, }); } }; @@ -42,7 +42,7 @@ export const editAnagraficaHandler = async ({ if (!userId) { throw new TRPCError({ code: "BAD_REQUEST", - message: "Errore interno, utente non trovato", + message: `Errore interno, utente non trovato - userId: ${userId}`, }); } @@ -62,7 +62,7 @@ export const editAnagraficaHandler = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore updateAnagrafica: ${(e as Error).message}`, + message: `Errore updateAnagrafica - userId: ${userId}: ${(e as Error).message}`, }); } }; @@ -71,10 +71,10 @@ export const deleteUserHandler = async (id: UsersId) => { try { await db.deleteFrom("users").where("id", "=", id).execute(); return { success: true }; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "errore cancellazione utente", + message: `errore cancellazione utente - id: ${id}: ${(e as Error).message}`, }); } }; @@ -112,10 +112,10 @@ export const getUserHandler = async ({ return null; } return user; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "errore get utente", + message: `errore get utente - id: ${id}: ${(e as Error).message}`, }); } }; @@ -131,22 +131,30 @@ export const getActiveUserWithoutChatHandler = async ({ }: { db: Querier; }) => { - const users = await db - .selectFrom("users") - .fullJoin("chats", "chats.user_ref", "users.id") - .select(["users.id", "users.username", "users.nome"]) - .where("chats.chatid", "is", null) - .where("users.isBlocked", "=", false) - .where("users.isAdmin", "=", false) - .execute(); - return users.filter((user): user is NonNullableUser => { - return user.id !== null && user.username !== null; - }); + try { + const users = await db + .selectFrom("users") + .fullJoin("chats", "chats.user_ref", "users.id") + .select(["users.id", "users.username", "users.nome"]) + .where("chats.chatid", "is", null) + .where("users.isBlocked", "=", false) + .where("users.isAdmin", "=", false) + .execute(); + return users.filter((user): user is NonNullableUser => { + return user.id !== null && user.username !== null; + }); + } catch (e) { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: `errore getActiveUserWithoutChatHandler: ${(e as Error).message}`, + }); + } }; export type UserWChatInfo = Pick< Users, | "id" + | "nome" | "username" | "email" | "telefono" @@ -162,43 +170,43 @@ export const getUsersWithChatInfoHandler = async (): Promise< UserWChatInfo[] > => { try { - return await db - .selectFrom("users") - .select([ - "users.id", + return await db + .selectFrom("users") + .select([ + "users.id", "users.nome", - "users.username", - "users.telefono", + "users.username", + "users.telefono", "users.extra_telefono_numero", "users.extra_telefono_titolo", - "users.email", - "users.isAdmin", - "users.isBlocked", - "users.created_at", - "users.note", - ]) - .leftJoin("chats", "chats.user_ref", "users.id") - .select(["chats.chatid"]) - .select((eb) => - jsonArrayFrom( - eb - .selectFrom("etichette") - .innerJoin( - "user_etichette", - "user_etichette.etichettaId", - "etichette.id_etichetta", - ) - .whereRef("user_etichette.userId", "=", "users.id") - .select([ - "etichette.id_etichetta", - "etichette.title", - "etichette.color_hex", - ]), - ).as("etichette"), - ) - .orderBy("users.id", "desc") - .select(["users.id as id"]) - .execute(); + "users.email", + "users.isAdmin", + "users.isBlocked", + "users.created_at", + "users.note", + ]) + .leftJoin("chats", "chats.user_ref", "users.id") + .select(["chats.chatid"]) + .select((eb) => + jsonArrayFrom( + eb + .selectFrom("etichette") + .innerJoin( + "user_etichette", + "user_etichette.etichettaId", + "etichette.id_etichetta", + ) + .whereRef("user_etichette.userId", "=", "users.id") + .select([ + "etichette.id_etichetta", + "etichette.title", + "etichette.color_hex", + ]), + ).as("etichette"), + ) + .orderBy("users.id", "desc") + .select(["users.id as id"]) + .execute(); } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", diff --git a/apps/infoalloggi/src/server/services/auth.service.ts b/apps/infoalloggi/src/server/services/auth.service.ts index dae2dbc..57550b3 100644 --- a/apps/infoalloggi/src/server/services/auth.service.ts +++ b/apps/infoalloggi/src/server/services/auth.service.ts @@ -25,10 +25,10 @@ export const genPasswordResetToken = async ({ id }: { id: UsersId }) => { .where("id", "=", id) .execute(); return newToken; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore interno", + message: `genPasswordResetToken: Errore interno: ${(e as Error).message}`, }); } }; @@ -49,7 +49,7 @@ export const isTokenValid = async ({ token }: { token: string }) => { } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore interno: ${(e as Error).message}`, + message: `isTokenValid: Errore interno: ${(e as Error).message}`, }); } }; @@ -91,7 +91,7 @@ export const resetPasswordFromTokenHandler = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore interno: ${(e as Error).message}`, + message: `Password Reset: Errore interno: ${(e as Error).message}`, }); } }; @@ -101,7 +101,7 @@ export const pwResetSendLinkHandler = async ({ email }: { email: string }) => { if (!user) { throw new TRPCError({ code: "NOT_FOUND", - message: "Utente non trovato", + message: `Password Reset: Utente non trovato con email: ${email}`, }); } @@ -143,10 +143,10 @@ export const passwordOverrideHandler = async ({ return { status: "success", }; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore interno", + message: `Password Override: Errore interno: ${(e as Error).message}`, }); } }; diff --git a/apps/infoalloggi/src/server/services/banners.service.ts b/apps/infoalloggi/src/server/services/banners.service.ts index 4146891..2deaf5a 100644 --- a/apps/infoalloggi/src/server/services/banners.service.ts +++ b/apps/infoalloggi/src/server/services/banners.service.ts @@ -20,10 +20,10 @@ export const getBanner = async ({ query = query.where("banners.show_public", "=", true); } return await query.execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore nel recupero dei dati", + message: `Errore nel recupero dei dati: ${(e as Error).message}`, }); } }; @@ -31,10 +31,10 @@ export const getBanner = async ({ export const getAllBanners = async ({ db }: { db: Querier }) => { try { return await db.selectFrom("banners").selectAll().execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore nel recupero dei dati", + message: `Errore nel recupero dei dati: ${(e as Error).message}`, }); } }; @@ -55,10 +55,10 @@ export const addBanner = async ({ }) .returning("banners.idbanner") .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore aggiunta banner", + message: `Errore aggiunta banner: ${(e as Error).message}`, }); } }; @@ -80,10 +80,10 @@ export const updateBanner = async ({ .where("banners.idbanner", "=", input.idbanner) .returning("banners.idbanner") .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore aggiornamento banner", + message: `Errore aggiornamento banner: ${(e as Error).message}`, }); } }; @@ -101,10 +101,10 @@ export const deleteBanner = async ({ .where("banners.idbanner", "=", input.idbanner) .execute(); return "ok"; - } catch { + } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Errore eliminazione banner", + message: `Errore eliminazione banner: ${(e as Error).message}`, }); } }; diff --git a/apps/infoalloggi/src/server/services/messages.service.ts b/apps/infoalloggi/src/server/services/messages.service.ts index 04cae3a..0a6cc0e 100644 --- a/apps/infoalloggi/src/server/services/messages.service.ts +++ b/apps/infoalloggi/src/server/services/messages.service.ts @@ -27,10 +27,10 @@ export const editMessage = async ({ .where("messages.messageid", "=", messageId) .returning("messageid") .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "BAD_REQUEST", - message: "Error while editing message", + message: `Error while editing message: ${(e as Error).message}`, }); } }; @@ -55,10 +55,10 @@ export const setReadMessage = async ({ .where("messages.chatid", "=", chatId) .returning("messages.chatid") .execute(); - } catch { + } catch (e) { throw new TRPCError({ code: "BAD_REQUEST", - message: "Error while setting read status", + message: `Error while setting read status: ${(e as Error).message}`, }); } }; diff --git a/apps/infoalloggi/src/server/services/servizio.service.ts b/apps/infoalloggi/src/server/services/servizio.service.ts index a83e36b..d74f642 100644 --- a/apps/infoalloggi/src/server/services/servizio.service.ts +++ b/apps/infoalloggi/src/server/services/servizio.service.ts @@ -65,7 +65,7 @@ export const getServizioById = async (servizioId: ServizioServizioId) => { } catch (e) { throw new TRPCError({ code: "NOT_FOUND", - message: `Servizio not found: ${(e as Error).message}`, + message: `Servizio not found - servizioId: ${servizioId}: ${(e as Error).message}`, }); } }; @@ -90,7 +90,7 @@ export const updateServizio = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Error updating servizio: ${(e as Error).message}`, + message: `Error updating servizio - servizioId: ${servizioId}: ${(e as Error).message}`, }); } }; @@ -105,7 +105,7 @@ export const deleteServizio = async (servizioId: ServizioServizioId) => { } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Error deleting servizio: ${(e as Error).message}`, + message: `Error deleting servizio - servizioId: ${servizioId}: ${(e as Error).message}`, }); } }; @@ -134,7 +134,7 @@ export const getServizioAnnuncio = async ({ } catch (e) { throw new TRPCError({ code: "NOT_FOUND", - message: `Servizio not found: ${(e as Error).message}`, + message: `Servizio not found - servizioId: ${servizioId}, annunciId: ${annuncioId}: ${(e as Error).message}`, }); } }; @@ -160,7 +160,7 @@ export const updateServizioAnnuncio = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Error updating servizio from annuncio: ${(e as Error).message}`, + message: `Error updating servizio from annuncio - servizioId: ${servizioId}, annunciId: ${annuncioId}: ${(e as Error).message}`, }); } }; @@ -179,7 +179,7 @@ export const deleteServizioAnnuncio = async ( } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Error deleting servizio from annuncio: ${(e as Error).message}`, + message: `Error deleting servizio from annuncio - servizioId: ${servizioId}, annunciId: ${annuncioId}: ${(e as Error).message}`, }); } }; diff --git a/apps/infoalloggi/src/server/services/testi_stringhe.service.ts b/apps/infoalloggi/src/server/services/testi_stringhe.service.ts index 3ee43bf..ebca3c0 100644 --- a/apps/infoalloggi/src/server/services/testi_stringhe.service.ts +++ b/apps/infoalloggi/src/server/services/testi_stringhe.service.ts @@ -28,7 +28,7 @@ export const getStringheFiltered = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore nel recupero delle stringhe: ${(e as Error).message}`, + message: `Errore nel recupero delle stringhe - contains: ${contains}: ${(e as Error).message}`, }); } }; @@ -49,7 +49,7 @@ export const getStringa = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore recupero stringa: ${(e as Error).message}`, + message: `Errore recupero stringa - stringaId: ${stringaId}: ${(e as Error).message}`, }); } }; @@ -72,7 +72,7 @@ export const newStringa = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore aggiunta della stringa: ${(e as Error).message}`, + message: `Errore aggiunta della stringa - stringaId: ${stringaId}: ${(e as Error).message}`, }); } }; @@ -96,7 +96,7 @@ export const updateStringhe = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore aggiornamento stringa: ${(e as Error).message}`, + message: `Errore aggiornamento stringa - stringaId: ${stringaId}: ${(e as Error).message}`, }); } }; @@ -117,7 +117,7 @@ export const deleteStringa = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore cancellazione stringa: ${(e as Error).message}`, + message: `Errore cancellazione stringa - stringaId: ${stringaId}: ${(e as Error).message}`, }); } }; diff --git a/apps/infoalloggi/src/server/services/user.service.ts b/apps/infoalloggi/src/server/services/user.service.ts index 33c28dd..29ba8a8 100644 --- a/apps/infoalloggi/src/server/services/user.service.ts +++ b/apps/infoalloggi/src/server/services/user.service.ts @@ -14,7 +14,7 @@ export const findUser_byId = async ({ id }: { id: string }) => { } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore findUser_byId: ${(e as Error).message}`, + message: `Errore findUser_byId - id: ${id}: ${(e as Error).message}`, }); } }; @@ -28,7 +28,7 @@ export const findUser_byEmail = async ({ email }: { email: string }) => { } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore findUser_byEmail: ${(e as Error).message}`, + message: `Errore findUser_byEmail - email: ${email}: ${(e as Error).message}`, }); } }; @@ -54,7 +54,7 @@ export const findUser_byId_MINI = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `errore findUser_byId_MINI: ${(e as Error).message}`, + message: `errore findUser_byId_MINI - userId: ${userId}: ${(e as Error).message}`, }); } }; @@ -77,7 +77,7 @@ export const getUser = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `errore getUtente: ${(e as Error).message}`, + message: `errore getUser - userId: ${userId}: ${(e as Error).message}`, }); } }; @@ -103,7 +103,7 @@ export const addUser = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore addUser: ${(e as Error).message}`, + message: `Errore addUser - email: ${data.email}: ${(e as Error).message}`, }); } }; @@ -170,7 +170,7 @@ export const getClientProfilo = async ({ } catch (e) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: `Errore interno: ${(e as Error).message}`, + message: `Errore interno - userId: ${userId}: ${(e as Error).message}`, }); } };