Catch `KeyError`; Add `response.text` to error message

pull/7289/head
Jack Minardi 2017-04-25 00:32:31 -04:00
parent 66a63b983e
commit 2d5da3e958
1 changed files with 3 additions and 2 deletions

View File

@ -195,8 +195,9 @@ class Tplink3DeviceScanner(TplinkDeviceScanner):
self.sysauth = regex_result.group(1)
_LOGGER.info(self.sysauth)
return True
except ValueError:
_LOGGER.error("Couldn't fetch auth tokens!")
except (ValueError, KeyError) as e:
_LOGGER.error("Couldn't fetch auth tokens!"
"Response was: {}".format(response.text))
return False
@Throttle(MIN_TIME_BETWEEN_SCANS)