Skip to content

Commit 72d48f1

Browse files
authored
Merge pull request #3347 from jeedom/refacto/use-throwable-in-catch
Refactor error handling to use \Throwable instead of Exception and Error
2 parents 2d29186 + f13f360 commit 72d48f1

14 files changed

Lines changed: 248 additions & 400 deletions

core/class/cmd.class.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,8 +1017,7 @@ public function formatValue($_value, $_quote = false) {
10171017
$calc = str_replace('#value#', $_value, $calc);
10181018
}
10191019
$_value = jeedom::evaluateExpression($calc);
1020-
} catch (Exception $ex) {
1021-
} catch (Error $ex) {
1020+
} catch (\Throwable $ex) {
10221021
}
10231022
}
10241023
switch ($this->getSubType()) {
@@ -2213,9 +2212,7 @@ public function pushUrl($_value) {
22132212
$http->setLogError(false);
22142213
try {
22152214
$http->exec();
2216-
} catch (Exception $e) {
2217-
log::add('cmd', 'error', __('Erreur push sur :', __FILE__) . ' ' . $url . ' commande : ' . $this->getHumanName() . ' => ' . log::exception($e));
2218-
} catch (Error $e) {
2215+
} catch (\Throwable $e) {
22192216
log::add('cmd', 'error', __('Erreur push sur :', __FILE__) . ' ' . $url . ' commande : ' . $this->getHumanName() . ' => ' . log::exception($e));
22202217
}
22212218
}

0 commit comments

Comments
 (0)