From: Coleman Watts Date: Wed, 30 Dec 2015 18:54:58 +0000 (-0500) Subject: Better errors for core form actions X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0e02cb0171ead56c0890e9eb2517d84e64f3b864;p=civicrm-core.git Better errors for core form actions --- diff --git a/CRM/Core/Action.php b/CRM/Core/Action.php index ab1979db14..6a82e0e81e 100644 --- a/CRM/Core/Action.php +++ b/CRM/Core/Action.php @@ -171,7 +171,7 @@ class CRM_Core_Action { * the corresponding action description */ public static function description($mask) { - if (!isset($_description)) { + if (!isset(self::$_description)) { self::$_description = array_flip(self::$_names); } diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 90e16dde38..c53091d56b 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1225,7 +1225,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { return 'get'; } // If you get this exception try adding more cases above. - throw new Exception("Cannot determine api action for " . get_class($this)); + throw new Exception("Cannot determine api action for " . get_class($this) . '.' . 'CRM_Core_Action "' . CRM_Core_Action::description($action) . '" not recognized.'); } /** @@ -1233,7 +1233,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @throws Exception */ public function getDefaultEntity() { - throw new Exception("Cannot determine default entity. The form class should implement getDefaultEntity()."); + throw new Exception("Cannot determine default entity. " . get_class($this) . " should implement getDefaultEntity()."); } /** @@ -1243,7 +1243,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @throws Exception */ public function getDefaultContext() { - throw new Exception("Cannot determine default context. The form class should implement getDefaultContext()."); + throw new Exception("Cannot determine default context. " . get_class($this) . " should implement getDefaultContext()."); } /**