From 98b86ca527bccd285de4712aee87ff3db54b33fc Mon Sep 17 00:00:00 2001 From: allburov Date: Sun, 20 Nov 2022 13:56:26 +0700 Subject: [PATCH] [core] Fix checkNumberStatus issue #26 --- src/core/session.venom.core.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/session.venom.core.ts b/src/core/session.venom.core.ts index 0a1a7366..689b1190 100644 --- a/src/core/session.venom.core.ts +++ b/src/core/session.venom.core.ts @@ -125,14 +125,13 @@ export class WhatsappSessionVenomCore extends WhatsappSession { async checkNumberStatus(request: CheckNumberStatusQuery): Promise { try { - const result = await this.whatsapp.checkNumberStatus(this.ensureSuffix(request.phone)) - return {numberExists: result['numberExists']} + return await this.whatsapp.checkNumberStatus(this.ensureSuffix(request.phone)) } 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} + // Catch number doesn't exist error and return it as is + if (error.status === 404 && !error.numberExists){ + return error + } + throw error } }