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 = "\"";