From 0c2412acae32fd7258c2cd5d39cb69461af56524 Mon Sep 17 00:00:00 2001 From: Reinier Battenberg Date: Thu, 12 Apr 2018 11:38:25 +0200 Subject: [PATCH] fix: Added another error scenario when the network connection disappears --- src/CognosRequest.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CognosRequest.js b/src/CognosRequest.js index d4d8c42..444b504 100644 --- a/src/CognosRequest.js +++ b/src/CognosRequest.js @@ -108,7 +108,11 @@ class CognosRequest { }) .catch(function(err) { // If there is another error, like a 500 or 404 (wrong URL) - if (err.response.status !== 441) { + // Also, if there is a network error there is no response + if ( + typeof err.response === 'undefined' || + err.response.status !== 441 + ) { throw err.message; } me.log('Expected Error in initialise');