/**
  * @param MvcEvent $e
  */
 public function reportMonitorEvent(MvcEvent $e)
 {
     $error = $e->getError();
     $exception = $e->getParam('exception');
     if ($exception instanceof \Exception || $exception instanceof \Throwable) {
         // @TODO clean up once PHP 7 requirement is enforced
         zend_monitor_custom_event_ex($error, $exception->getMessage(), 'Zend Framework Exception', ['code' => $exception->getCode(), 'trace' => $exception->getTraceAsString()]);
     }
 }
示例#2
0
 /**
  * @param MvcEvent $e
  */
 public function reportMonitorEvent(MvcEvent $e)
 {
     $error = $e->getError();
     $exception = $e->getParam('exception');
     if ($exception instanceof \Exception) {
         zend_monitor_custom_event_ex($error, $exception->getMessage(), 'Zend Framework Exception', array('code' => $exception->getCode(), 'trace' => $exception->getTraceAsString()));
     }
 }
 /**
  * Create a custom event in Zend Server
  *
  * @param  MvcEvent $e
  * @return void
  */
 public function createCustomEvent(MvcEvent $e)
 {
     // Do nothing if no error in the event
     $error = $e->getError();
     if (empty($error)) {
         return;
     }
     // Do nothing if the result is a response object
     $result = $e->getResult();
     if ($result instanceof Response) {
         return;
     }
     switch ($error) {
         case Application::ERROR_CONTROLLER_NOT_FOUND:
         case Application::ERROR_CONTROLLER_INVALID:
         case Application::ERROR_ROUTER_NO_MATCH:
             // Specifically not handling these
             return;
         case Application::ERROR_EXCEPTION:
         default:
             if (!empty($e)) {
                 $exception = $e->getParam('exception');
                 /* @var $exception \Exception */
                 $message = 'An error occurred during execution: ' . $exception->getMessage();
                 if ($this->isCustomEventByRuleIsEnabled()) {
                     zend_monitor_custom_event_ex('Zend Framework Exception', $message, 'Zend Framework Exception Rule');
                 } elseif ($this->isCustomEventIsEnabled) {
                     zend_monitor_custom_event('Zend Framework Exception', $message);
                 }
             }
     }
 }