From c5c53c33b4b63965f2299142da151cfb55c89bae Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Fri, 12 May 2023 07:46:29 -0400 Subject: [PATCH] Improved some exception handling. --- api/ecobee_sensor.php | 4 ++-- api/ecobee_thermostat.php | 4 ++-- api/runtime.php | 2 +- api/thermostat.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/ecobee_sensor.php b/api/ecobee_sensor.php index 84a4522..2800c17 100644 --- a/api/ecobee_sensor.php +++ b/api/ecobee_sensor.php @@ -219,10 +219,10 @@ class ecobee_sensor extends cora\crud { ] ); } else { - throw $e; + throw new cora\exception($e->getMessage(), $e->getCode(), $e->getReportable(), $e->getExtraInfo(), $e->getRollback()); } } else { - throw $e; + throw new cora\exception($e->getMessage(), $e->getCode(), $e->getReportable(), $e->getExtraInfo(), $e->getRollback()); } } diff --git a/api/ecobee_thermostat.php b/api/ecobee_thermostat.php index a817d65..a211ae6 100644 --- a/api/ecobee_thermostat.php +++ b/api/ecobee_thermostat.php @@ -182,10 +182,10 @@ class ecobee_thermostat extends cora\crud { ] ); } else { - throw $e; + throw new cora\exception($e->getMessage(), $e->getCode(), $e->getReportable(), $e->getExtraInfo(), $e->getRollback()); } } else { - throw $e; + throw new cora\exception($e->getMessage(), $e->getCode(), $e->getReportable(), $e->getExtraInfo(), $e->getRollback()); } } diff --git a/api/runtime.php b/api/runtime.php index c48b07d..ac9da3e 100644 --- a/api/runtime.php +++ b/api/runtime.php @@ -406,7 +406,7 @@ class runtime extends cora\api { strtotime('+1 hour', $end) ); } else { - throw $e; + throw new cora\exception($e->getMessage(), $e->getCode(), $e->getReportable(), $e->getExtraInfo(), $e->getRollback()); } } diff --git a/api/thermostat.php b/api/thermostat.php index 807f205..da716a9 100644 --- a/api/thermostat.php +++ b/api/thermostat.php @@ -172,7 +172,7 @@ class thermostat extends cora\crud { return true; } catch(cora\exception $e) { if($e->getCode() === 10511) { - throw $e; + throw new cora\exception($e->getMessage(), $e->getCode(), $e->getReportable(), $e->getExtraInfo(), $e->getRollback()); } else { return false; }