--- /dev/null
+<?php
+/**
+ * Created by PhpStorm.
+ * User: eileen
+ * Date: 8/12/2014
+ * Time: 10:33 AM
+ */
+
+class CRM_Contribute_Exception_InactiveContributionPageException extends Exception{
+ private $id;
+ public function __construct($message, $id) {
+ parent::__construct(ts($message));
+ $this->id = $id;
+ CRM_Core_Error::debug_log_message('inactive contribution page access attempted - page number ' . $id);
+ }
+
+ public function getID() {
+ return $this->id;
+ }
+}
/**
* Set variables up before form is built
*
+ * @throws CRM_Contribution_Exception_InactiveContributionPageException
* @return void
*/
public function preProcess() {
+
$config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values);
- // check if form is active
if (empty($this->_values['is_active'])) {
- // form is inactive, die a fatal death
- CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
+ throw new CRM_Contribute_Exception_InactiveContributionPageException(ts('The page you requested is currently unavailable.'), $this->_id);
}
// also check for billing informatin
* @static
*/
public static function handleUnhandledException($exception) {
+ try {
+ CRM_Utils_Hook::unhandledException($exception);
+ } catch (Exception $other) {
+ // if the exception-handler generates an exception, then that sucks! oh, well. carry on.
+ }
$config = CRM_Core_Config::singleton();
$vars = array(
'message' => $exception->getMessage(),
);
}
+ /**
+ * @param CRM_Core_Exception Exception $exception
+ */
+ static function unhandledException($exception) {
+ self::singleton()->invoke(1, $exception, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_unhandled_exception');
+ }
/**
* This hook is called for declaring managed entities via API