From 38c723dfa20e6c8b7b2f6c313eeb73eb47125dd2 Mon Sep 17 00:00:00 2001 From: Siddharth VP Date: Sat, 8 Jan 2022 13:00:46 +0530 Subject: [PATCH] log network error info in console --- package-lock.json | 1 + src/core.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/package-lock.json b/package-lock.json index 20d3100..62d708f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "mwn", "version": "1.11.4", "license": "LGPL-3.0-or-later", "dependencies": { diff --git a/src/core.ts b/src/core.ts index 0e0f454..ecfbb47 100644 --- a/src/core.ts +++ b/src/core.ts @@ -372,6 +372,10 @@ export class Response { return rejectWithError(errorData); } + /** + * This handles errors at the network level + * @param {Object} error + */ handleRequestFailure(error: any) { if ( !error.disableRetry && @@ -381,6 +385,7 @@ export class Response { ) { // error might be transient, give it another go! log(`[W] Encountered ${error}, retrying in ${this.bot.options.retryPause / 1000} seconds`); + console.log(error); // log the full error for upstream reporting if required return sleep(this.bot.options.retryPause).then(() => { return this.retry(); });