From 05cd1c410aced59f4ac572c1bbfe18603b1cb047 Mon Sep 17 00:00:00 2001 From: m5r Date: Sat, 2 Jul 2022 01:49:53 +0200 Subject: [PATCH] return null instead of throwing an error --- app/features/phone-calls/loaders/twilio-token.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/features/phone-calls/loaders/twilio-token.ts b/app/features/phone-calls/loaders/twilio-token.ts index 3c2c403..5b74c14 100644 --- a/app/features/phone-calls/loaders/twilio-token.ts +++ b/app/features/phone-calls/loaders/twilio-token.ts @@ -19,7 +19,10 @@ const loader: LoaderFunction = async ({ request }) => { const twilioAccount = await db.twilioAccount.findUnique({ where: { accountSid: twilio.accountSid } }); if (!twilioAccount || !twilioAccount.twimlAppSid) { - throw new Error("unreachable"); + logger.warn( + "Twilio account is connected but the background jobs didn't run properly, this shouldn't be happening", + ); + return null; } const twilioClient = getTwilioClient(twilioAccount);