From adc51c5ce1ecc2d041e17c1b5913bb375e1cb450 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 9 Jan 2009 13:42:13 -0500 Subject: [PATCH] Add a vimeo exception class - start throwing exceptions where appropriate, and put this under the bsd license. --- framework/Service_Vimeo/lib/Horde/Service/Vimeo.php | 12 +++++------- .../Service_Vimeo/lib/Horde/Service/Vimeo/Exception.php | 14 ++++++++++++++ framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php | 6 +++--- 3 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 framework/Service_Vimeo/lib/Horde/Service/Vimeo/Exception.php diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php index 5fa60d6ee..0e1c0436a 100644 --- a/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php @@ -5,10 +5,10 @@ * * Copyright 2008-2009 The Horde Project (http://www.horde.org) * - * See the enclosed file COPYING for license information (GPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. - * * @author Michael J. Rubinsky + * @license http://opensource.org/licenses/bsd-license.php BSD + * @category Horde + * @package Horde_Service_Vimeo */ class Horde_Service_Vimeo { @@ -66,10 +66,9 @@ class Horde_Service_Vimeo { */ public static function factory($driver = 'Simple', $params = null) { - // Check for required dependencies if (empty($params['http_client'])) { - // Throw exception + throw new InvalidArgumentException('A http client object is required'); } $driver = basename($driver); @@ -79,8 +78,7 @@ class Horde_Service_Vimeo { if (class_exists($class)) { return new $class($params['http_client'], $params); } else { - // @TODO: Exceptions!!! - Horde::fatal(PEAR::raiseError(sprintf(_("Unable to load the definition of %s."), $class)), __FILE__, __LINE__); + throw new Horde_Service_Vimeo_Exception(sprintf("Unable to load the definition of %s.", $class)); } } diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Exception.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Exception.php new file mode 100644 index 000000000..652195b51 --- /dev/null +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Exception.php @@ -0,0 +1,14 @@ + + * @license http://opensource.org/licenses/bsd-license.php BSD + * @category Horde + * @package Horde_Service_Vimeo + */ +class Horde_Service_Vimeo_Exception extends Exception +{ +} \ No newline at end of file diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php index 853e767bb..224925833 100644 --- a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php @@ -5,10 +5,10 @@ * * Copyright 2008-2009 The Horde Project (http://www.horde.org) * - * See the enclosed file COPYING for license information (GPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. - * * @author Michael J. Rubinsky + * @license http://opensource.org/licenses/bsd-license.php BSD + * @category Horde + * @package Horde_Service_Vimeo */ class Horde_Service_Vimeo_Simple extends Horde_Service_Vimeo { -- 2.11.0