diff --git a/apps/infoalloggi/src/components/IconComponents.tsx b/apps/infoalloggi/src/components/IconComponents.tsx index 9c53345..60911dc 100644 --- a/apps/infoalloggi/src/components/IconComponents.tsx +++ b/apps/infoalloggi/src/components/IconComponents.tsx @@ -203,7 +203,7 @@ export const IconMatrix = ({ type, ...rest }: IconMatrixProps) => { case "thumbs-up": return ; default: - return
Icon not found
; + throw new Error(`Invalid icon type: ${type satisfies never}`); } }; diff --git a/apps/infoalloggi/src/components/custom_ui/fileUpload.tsx b/apps/infoalloggi/src/components/custom_ui/fileUpload.tsx index 7816ecc..c84e015 100644 --- a/apps/infoalloggi/src/components/custom_ui/fileUpload.tsx +++ b/apps/infoalloggi/src/components/custom_ui/fileUpload.tsx @@ -204,7 +204,7 @@ function createStore( } default: - return state; + throw new Error(`Unhandled action type: ${action satisfies never}`); } } @@ -1291,7 +1291,7 @@ function FileUploadItemProgress(props: FileUploadItemProgressProps) { ); } - default: + case "linear": return ( ); + default: + throw new Error(`Unknown variant: ${variant satisfies never}`); } } diff --git a/apps/infoalloggi/src/components/map/Map.tsx b/apps/infoalloggi/src/components/map/Map.tsx index 5709264..e8b68de 100644 --- a/apps/infoalloggi/src/components/map/Map.tsx +++ b/apps/infoalloggi/src/components/map/Map.tsx @@ -158,6 +158,8 @@ const MapComp = ({ ); + default: + throw new Error(`Invalid marker type: ${markerType satisfies never}`); } }; diff --git a/apps/infoalloggi/src/i18n/stripe.ts b/apps/infoalloggi/src/i18n/stripe.ts index 5018eec..a55d29a 100644 --- a/apps/infoalloggi/src/i18n/stripe.ts +++ b/apps/infoalloggi/src/i18n/stripe.ts @@ -148,5 +148,7 @@ export const PaymentMethodToString = (type: PaymentType) => { return "WeChat Pay"; case "zip": return "Zip"; + default: + throw new Error(`Invalid payment type: ${type satisfies never}`); } }; diff --git a/apps/infoalloggi/src/server/services/mailer.ts b/apps/infoalloggi/src/server/services/mailer.ts index 6a695a4..cbd746b 100644 --- a/apps/infoalloggi/src/server/services/mailer.ts +++ b/apps/infoalloggi/src/server/services/mailer.ts @@ -183,14 +183,10 @@ export const genMail = async ({ ...mail }: MailsTemplates) => { title = "Invito al sito"; break; default: - mailComponent = null; - break; - } - if (mailComponent === null) { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: "Errore nella creazione dell'email", - }); + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: `Tipo di email non valido: ${mail satisfies never}`, + }); } return { html: await render(mailComponent), title };