From dfa7bc2ca891debdd2e1738c2d247a4d4744b2f7 Mon Sep 17 00:00:00 2001 From: allburov Date: Mon, 3 Oct 2022 12:04:13 +0700 Subject: [PATCH] Log errors --- src/api/chatting.controller.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/api/chatting.controller.ts b/src/api/chatting.controller.ts index d3a0bc93..2bc40d12 100644 --- a/src/api/chatting.controller.ts +++ b/src/api/chatting.controller.ts @@ -10,8 +10,8 @@ import { MessageLocation, MessageReply, MessageText, - MessageTextQuery, - MessageTextButtons + MessageTextButtons, + MessageTextQuery } from "./all.dto"; import {ensureSuffix, WhatsappSessionManager} from "../whatsapp.service"; @@ -30,7 +30,11 @@ export class ChattingController { try { const result = await whatsapp.checkNumberStatus(ensureSuffix(request.phone)) return {numberExists: result['numberExists']} - } catch (e) { + } catch (error) { + // We need to "touch" the error in order to get unhandled rejections + // It logs out the session and stop the app + console.log(typeof error) + console.log(error) return {numberExists: false} } }