From 139bc99cc706ec6f5ae9a0eb51f64a1966fae08d Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 23 Jun 2017 16:37:08 +0530 Subject: [PATCH] Adding error logs when unexpected error from gateway --- .../devicemgt/app/modules/business-controllers/device.js | 4 ++++ .../resources/jaggeryapps/devicemgt/app/modules/constants.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index 3181fc7a62d..0300b99e183 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -259,6 +259,10 @@ deviceModule = function () { } return serviceInvokers.XMLHttp.get( url, function (responsePayload) { + if(!responsePayload["responseText"]){ + log.error("Error while fetching device count. API `" + url + "` returns HTTP: " + responsePayload["status"]); + throw constants["ERRORS"]["UNKNOWN_ERROR"]; + } return parse(responsePayload["responseText"])["count"]; }, function (responsePayload) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js index 56d03a6ce9f..f499da1c999 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js @@ -47,7 +47,8 @@ var LANGUAGE_US = "en_US"; var VENDOR_APPLE = "Apple"; var ERRORS = { - "USER_NOT_FOUND": "USER_NOT_FOUND" + "USER_NOT_FOUND": "USER_NOT_FOUND", + "UNKNOWN_ERROR": "Unknown Error" }; var USER_STORES_NOISY_CHAR = "\"";