<?php
class CRM_Core_LegacyErrorHandler {
- static function handledException($e) {
+ /**
+ * @param \Civi\Core\Event\UnhandledExceptionEvent $event
+ * @throws Exception
+ */
+ static function handleException($event) {
+ $e = $event->exception;
if ($e instanceof CRM_Core_Exception) {
$params = $e->getErrorData();
$message = $e->getMessage();
}
}
}
+
}
/**
* @param CRM_Core_Exception Exception $exception
+ * @param mixed $request reserved for future use
*/
- static function unhandledException($exception) {
- self::singleton()->invoke(1, $exception, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,'civicrm_unhandled_exception');
+ static function unhandledException($exception, $request = NULL) {
+ self::singleton()->invoke(2, $exception, $request, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,'civicrm_unhandled_exception');
+ // == 4.4 ==
+ //$event = new stdClass();
+ //$event->exception = $exception;
+ //CRM_Core_LegacyErrorHandler::handleException($event);
+
// == 4.5+ ==
- $event = new \Civi\Core\Event\UnhandledExceptionEvent(self::$_nullObject, $exception);
- \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("unhandled_exception", $event);
+ $event = new \Civi\Core\Event\UnhandledExceptionEvent($exception, self::$_nullObject);
+ \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_unhandled_exception", $event);
}
/**
$dispatcher->addListener('DAO::post-insert', array('\CRM_Core_BAO_RecurringEntity', 'triggerInsert'));
$dispatcher->addListener('DAO::post-update', array('\CRM_Core_BAO_RecurringEntity', 'triggerUpdate'));
$dispatcher->addListener('DAO::post-delete', array('\CRM_Core_BAO_RecurringEntity', 'triggerDelete'));
- $dispatcher->addListener('hook_civicrm_unhandled_exception', array('CRM_Core_LegacyErrorHandler', 'handleException');
+ $dispatcher->addListener('hook_civicrm_unhandled_exception', array('CRM_Core_LegacyErrorHandler', 'handleException'));
return $dispatcher;
}
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.4 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
+
+namespace Civi\Core\Event;
+
+/**
+ * Class AuthorizeEvent
+ * @package Civi\API\Event
+ */
+class UnhandledExceptionEvent extends \Symfony\Component\EventDispatcher\Event {
+
+ /**
+ * @var \Exception
+ */
+ public $exception;
+
+ /**
+ * @var mixed reserved for future use
+ */
+ public $request;
+
+ function __construct($e, $request) {
+ $this->request = $request;
+ $this->exception = $e;
+ }
+}