From 94043da7eccf1844adea103a2b9f1ca8b0cb5584 Mon Sep 17 00:00:00 2001 From: Vishnu Pujari Date: Thu, 24 Jul 2025 22:30:12 +0530 Subject: [PATCH] fix 10dlc error --- lib/utils/restException.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/utils/restException.js b/lib/utils/restException.js index d41e200d..5685e797 100644 --- a/lib/utils/restException.js +++ b/lib/utils/restException.js @@ -1,20 +1,29 @@ - class PlivoRestError extends Error { constructor(response) { response = response.response var body; + super('[HTTP ' + response.status + '] Failed to execute request'); try { body = typeof response.data === 'string' ? JSON.parse(response.data) : response.data; } catch (err) { body = {"error": response.data, "api_id": ''} } + this.status = response.status; this.statusText = response.statusText this.message = body.error; this.apiID = body.api_id; - this.moreInfo = response.config.data + this.moreInfo = response.config.data; + this.errorCode = body["error code"]; + this.src = body.src; + this.dest = body.dest; + this.invalidNumbers = body.invalid_number; + this.unMappedNumbers = body.unmapped_number; + this.unMappedTendlcNumbers = body.unmapped_10dlc_numbers; + this.brandTPDFailedNumbers = body.brand_tpd_failed_numbers; + this.messageUUID = body.message_uuid; } } -module.exports = PlivoRestError; +module.exports = PlivoRestError; \ No newline at end of file