From ff284e071b67e950e6a9dd7443d75112579a5374 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sun, 7 Jun 2009 15:02:29 -0400 Subject: [PATCH] Catch any exceptions here continue --- timeobjects/lib/Driver/Weatherdotcom.php | 2 ++ timeobjects/lib/api.php | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/timeobjects/lib/Driver/Weatherdotcom.php b/timeobjects/lib/Driver/Weatherdotcom.php index cf4790ddc..49378579f 100644 --- a/timeobjects/lib/Driver/Weatherdotcom.php +++ b/timeobjects/lib/Driver/Weatherdotcom.php @@ -27,6 +27,8 @@ class TimeObjects_Driver_Weatherdotcom extends TimeObjects_Driver $params['location'] = $contact['homeCity'] . (!empty($contact['homeProvince']) ? ', ' . $contact['homeProvince'] : '') . (!empty($contact['homeCountry']) ? ', ' . $contact['homeCountry'] : ''); } + // TODO: Try some other way? + parent::__construct($params); } diff --git a/timeobjects/lib/api.php b/timeobjects/lib/api.php index f79f3106a..c335ee633 100644 --- a/timeobjects/lib/api.php +++ b/timeobjects/lib/api.php @@ -46,7 +46,13 @@ function _timeobjects_listTimeObjects($time_categories, $start, $end) $return = array(); foreach ($time_categories as $category) { $drv = TimeObjects_Driver::factory($category); - $new = $drv->listTimeObjects($start, $end); + + try { + $new = $drv->listTimeObjects($start, $end); + } catch (TimeObjects_Exception $e) { + //@TODO: Log the error, but return an empty array. + $new = array(); + } $return = array_merge($return, $new); } -- 2.11.0