Revision
128
Author
emsmith
Date
2007-02-01 09:54:09 -0800 (Thu, 01 Feb 2007)

Log Message

A little error handling for unfound actions (catch it or else :)

Modified Paths

Diff

Modified: trunk/lib/actions.class.php (127 => 128)


--- trunk/lib/actions.class.php	2007-01-27 18:47:25 UTC (rev 127)
+++ trunk/lib/actions.class.php	2007-02-01 17:54:09 UTC (rev 128)
@@ -75,7 +75,11 @@
 	 */
 	public function get_group($group)
 	{
-		return isset($this->groups[$group]) ? $this->groups[$group] : NULL;
+		if (!isset($this->groups[$group]))
+		{
+			throw new CC_Exception('The group %s could not be found', $group);
+		}
+		return $this->groups[$group];
 	}
 
 	/**
@@ -101,7 +105,15 @@
 	 */
 	public function get_action($group, $action)
 	{
-		return $this->get_group($group)->get_action($action);
+		$action = $this->get_group($group)->get_action($action);
+		if ($action instanceof GtkAction)
+		{
+			return $action;
+		}
+		else
+		{
+			throw new CC_Exception('The action %s in group %s could not be found', $action, $group);
+		}
 	}
 
 	/**