1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Better handling for ecobee authorization errors

This commit is contained in:
Jon Ziebell 2020-06-09 21:26:31 -04:00
parent f611cb4174
commit ac2ae13690

View File

@ -250,6 +250,14 @@ class ecobee extends external_api {
}
throw new Exception($response['status']['message']);
}
else if (isset($response['error']) === true) {
// Authorization errors are a bit different
// https://www.ecobee.com/home/developer/api/documentation/v1/auth/auth-req-resp.shtml
if($this::$log_mysql !== 'all') {
$this->log_mysql($curl_response, true);
}
throw new Exception(isset($response['error_description']) === true ? $response['error_description'] : $response['error']);
}
else {
return $response;
}