/**
  * {@inheritdoc}
  */
 public function render($debug, $type, array $error, $exception = null, $outputBuffer = null)
 {
     echo "\n";
     if ($debug) {
         if ($exception instanceof DebugException) {
             // debug exception
             echo "[Debug";
             if (null !== $exception->getTitle()) {
                 echo ': ', $exception->getTitle();
             }
             echo "]\n\n", $exception->getMessage();
         } else {
             // error or exception
             echo '[', ErrorHandler::getErrorTypeName($type), "]\n\n";
             if (null === $exception) {
                 // error
                 echo DebugUtil::formatArray($error, ' > ');
             } else {
                 // exception
                 echo DebugUtil::formatException($exception, ' > ');
             }
         }
     } else {
         // non-debug
         echo 'Internal application error';
     }
 }
 /**
  * Dispatch an event
  *
  * @param  string $eventName  partial event name (is prefixed automatically)
  * @param  array  $eventAttrs event attributes
  * @return Event
  */
 protected function dispatchEvent($eventName, $eventAttrs = array())
 {
     $event = new Event($eventAttrs);
     $eventDispatcher = $this->errorHandler->getEventDispatcher();
     if (null !== $eventDispatcher) {
         $eventDispatcher->dispatch("error_handler.web.{$eventName}", $event);
     }
     return $event;
 }