mirror of
https://github.com/beestat/app.git
synced 2025-06-23 15:30:43 -04:00
Upgraded exception class for ecobee and Patreon tokens
This commit is contained in:
parent
7ffea8ec2d
commit
d6e05b7cef
@ -37,7 +37,7 @@ class ecobee_token extends cora\crud {
|
|||||||
isset($response['access_token']) === false ||
|
isset($response['access_token']) === false ||
|
||||||
isset($response['refresh_token']) === false
|
isset($response['refresh_token']) === false
|
||||||
) {
|
) {
|
||||||
throw new Exception('Could not get first token.', 10000);
|
throw new cora\exception('Could not get first ecobee token.', 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@ -73,7 +73,7 @@ class ecobee_token extends cora\crud {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
if(count($ecobee_tokens) === 0) {
|
if(count($ecobee_tokens) === 0) {
|
||||||
throw new Exception('Could not refresh ecobee token; no token found.', 10001);
|
throw new cora\exception('Could not refresh ecobee token; no token found.', 10001);
|
||||||
}
|
}
|
||||||
$ecobee_token = $ecobee_tokens[0];
|
$ecobee_token = $ecobee_tokens[0];
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ class ecobee_token extends cora\crud {
|
|||||||
$this->delete($ecobee_token['ecobee_token_id']);
|
$this->delete($ecobee_token['ecobee_token_id']);
|
||||||
$this->api('user', 'log_out', ['all' => true]);
|
$this->api('user', 'log_out', ['all' => true]);
|
||||||
$database->release_lock($lock_name);
|
$database->release_lock($lock_name);
|
||||||
throw new Exception('Could not refresh ecobee token; ecobee returned no token.', 10002);
|
throw new cora\exception('Could not refresh ecobee token; ecobee returned no token.', 10002);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ecobee_token = $database->update(
|
$ecobee_token = $database->update(
|
||||||
|
@ -37,7 +37,7 @@ class patreon_token extends cora\crud {
|
|||||||
isset($response['access_token']) === false ||
|
isset($response['access_token']) === false ||
|
||||||
isset($response['refresh_token']) === false
|
isset($response['refresh_token']) === false
|
||||||
) {
|
) {
|
||||||
throw new Exception('Could not get first token', 10100);
|
throw new cora\exception('Could not get first Patreon token.', 10100);
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_patreon_token = [
|
$new_patreon_token = [
|
||||||
@ -82,7 +82,7 @@ class patreon_token extends cora\crud {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
if(count($patreon_tokens) === 0) {
|
if(count($patreon_tokens) === 0) {
|
||||||
throw new Exception('Could not refresh patreon token; no token found.', 10101);
|
throw new cora\exception('Could not refresh Patreon token; no token found.', 10101);
|
||||||
}
|
}
|
||||||
$patreon_token = $patreon_tokens[0];
|
$patreon_token = $patreon_tokens[0];
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ class patreon_token extends cora\crud {
|
|||||||
) {
|
) {
|
||||||
$this->delete($patreon_token['patreon_token_id']);
|
$this->delete($patreon_token['patreon_token_id']);
|
||||||
$database->release_lock($lock_name);
|
$database->release_lock($lock_name);
|
||||||
throw new Exception('Could not refresh patreon token; patreon returned no token.', 10102);
|
throw new cora\exception('Could not refresh Patreon token; Patreon returned no token.', 10102);
|
||||||
}
|
}
|
||||||
|
|
||||||
$database->update(
|
$database->update(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user