Add a vimeo exception class - start throwing exceptions where
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 9 Jan 2009 18:42:13 +0000 (13:42 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 9 Jan 2009 18:42:13 +0000 (13:42 -0500)
appropriate, and put this under the bsd license.

framework/Service_Vimeo/lib/Horde/Service/Vimeo.php
framework/Service_Vimeo/lib/Horde/Service/Vimeo/Exception.php [new file with mode: 0644]
framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php

index 5fa60d6..0e1c043 100644 (file)
@@ -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 <mrubinsk@horde.org>
+ * @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 (file)
index 0000000..652195b
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Vimeo exceptions
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org)
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @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
index 853e767..2249258 100644 (file)
@@ -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 <mrubinsk@horde.org>
+ * @license  http://opensource.org/licenses/bsd-license.php BSD
+ * @category Horde
+ * @package  Horde_Service_Vimeo
  */
 class Horde_Service_Vimeo_Simple extends Horde_Service_Vimeo {