Additional error handling (#13146)

Signed-off-by: matchews <mmyers75@icloud.com>
This commit is contained in:
Matt 2022-07-20 10:26:15 -04:00 committed by GitHub
parent d2670e40cb
commit 848ec83d52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -199,6 +199,7 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
xmlResponse = httpXmlResponse(urlParameters);
if (xmlResponse.isEmpty()) {
logger.debug("Hayward Connection thing: Login XML response was null");
return false;
}
@ -227,7 +228,7 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
xmlResponse = httpXmlResponse(urlParameters);
if (xmlResponse.isEmpty()) {
logger.debug("Hayward Connection thing: Login XML response was null");
logger.debug("Hayward Connection thing: getApiDef XML response was null");
return false;
}
return true;
@ -277,12 +278,12 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
String xmlResponse = httpXmlResponse(urlParameters);
if (xmlResponse.isEmpty()) {
logger.debug("Hayward Connection thing: requestConfig XML response was null");
logger.debug("Hayward Connection thing: getMSPConfig XML response was null");
return "Fail";
}
if (evaluateXPath("//Backyard/Name/text()", xmlResponse).isEmpty()) {
logger.debug("Hayward Connection thing: requestConfiguration XML response: {}", xmlResponse);
logger.debug("Hayward Connection thing: getMSPConfig XML response: {}", xmlResponse);
return "Fail";
}
return xmlResponse;
@ -294,6 +295,10 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
String xmlResponse = getMspConfig();
if (xmlResponse.contentEquals("Fail")) {
return false;
}
// Get Units (Standard, Metric)
property1 = evaluateXPath("//System/Units/text()", xmlResponse);
account.units = property1.get(0);