Example #1
0
 public function build()
 {
     $this->doc = new \DOMDocument('1.0', 'UTF-8');
     $dom_root = $this->doc->createElement('document');
     $dom_root->setAttribute('debug', $this->getConfigValue('site.debug'));
     $dom_root->setAttribute('url', (string) E()->getRequest()->getURI());
     $this->doc->appendChild($dom_root);
     $dom_documentProperties = $this->doc->createElement('properties');
     $dom_root->appendChild($dom_documentProperties);
     $prop = $this->doc->createElement('property', E()->getSiteManager()->getCurrentSite()->base);
     $prop->setAttribute('name', 'base');
     $prop->setAttribute('folder', E()->getSiteManager()->getCurrentSite()->folder);
     $dom_documentProperties->appendChild($prop);
     $prop = $this->doc->createElement('property', $langID = E()->getLanguage()->getCurrent());
     $prop->setAttribute('name', 'lang');
     $prop->setAttribute('abbr', E()->getRequest()->getLangSegment());
     $prop->setAttribute('real_abbr', E()->getLanguage()->getAbbrByID($langID));
     $dom_documentProperties->appendChild($prop);
     unset($prop);
     $result = $this->doc->createElement('errors');
     $result->setAttribute('xml:id', 'result');
     $dom_root->appendChild($result);
     $vm = E()->getController()->getViewMode();
     if ($vm == DocumentController::TRANSFORM_JSON) {
         $errors = [['message' => $this->e->getMessage()]];
         $data = ['result' => false, 'errors' => $errors];
         $result->appendChild(new \DOMText(json_encode($data)));
     } else {
         $error = $this->doc->createElement('error');
         $result->appendChild($error);
         $error->appendChild($this->doc->createElement('message', $this->e->getMessage()));
         $error->setAttribute('file', $this->e->getFile());
         $error->setAttribute('line', $this->e->getLine());
         $bktrace = $this->doc->createElement('backtrace');
         $dbgObj = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT, 5);
         array_walk($dbgObj, function ($callable) use($bktrace) {
             $bktrace->appendChild($call = $this->doc->createElement('call'));
             array_walk($callable, function ($value, $key) use($call) {
                 if (is_scalar($value)) {
                     $call->appendChild($this->doc->createElement($key, $value));
                 } elseif (is_array($value)) {
                     foreach ($value as $k1 => $v1) {
                         if (!is_scalar($v1)) {
                             $v1 = '[...]';
                         }
                         $call->appendChild($this->doc->createElement($key, $v1));
                     }
                 }
             });
         });
         $result->appendChild($bktrace);
         if ($vm == DocumentController::TRANSFORM_HTML) {
             E()->getController()->getTransformer()->setFileName('error_page.xslt');
         }
     }
 }
Example #2
0
 /**
  * @param string $message Application message.
  * @param string $databaseMessage Database reason.
  * @param \Exception $previous The previous exception used for the exception chaining.
  */
 public function __construct($message = "", $databaseMessage = "", \Exception $previous = null)
 {
     if ($message != "" && $databaseMessage != "") {
         $message .= ": " . $databaseMessage;
     } elseif ($message == "" && $databaseMessage != "") {
         $message = $databaseMessage;
     }
     $this->databaseMessage = $databaseMessage;
     parent::__construct($message, 400, '', 0, $previous);
 }
 public function __construct($message = "", \Exception $previous = null)
 {
     parent::__construct($message, 150, '', '', $previous);
 }
Example #4
0
 public function __construct($exporter, $message = null, $code = 0)
 {
     parent::__construct($message, $code);
 }
 /**
  * Prints the error page.
  */
 public function show()
 {
     $this->information .= '<b>socket error:</b> ' . StringUtil::encodeHTML($this->getErrorDesc()) . '<br />';
     $this->information .= '<b>socket error number:</b> ' . StringUtil::encodeHTML($this->getErrorNumber()) . '<br />';
     $this->information .= '<b>socket address:</b> ' . StringUtil::encodeHTML($this->getSocketAddress()) . '<br />';
     $this->information .= '<b>socket port:</b> ' . StringUtil::encodeHTML($this->getSocketPort()) . '<br />';
     parent::show();
 }
 /**
  * Prints the error page.
  */
 public function show()
 {
     $this->information .= '<b>event id:</b> ' . intval($this->getEventID()) . '<br />';
     $this->information .= '<b>event handler no:</b> ' . intval($this->getEventTypeID()) . '<br />';
     $this->information .= '<b>event handler objekt:</b> ' . StringUtil::encodeHTML(print_r($this->h, true)) . '<br />';
     parent::show();
 }
 /**
  * Creates a new TemplatePatchException.
  * 
  * @param	string		$message	error message
  * @param	integer		$code		error code
  * @param 	string		$templateName	affected template
  * @param	string		$description	description of the error	
  */
 public function __construct($message = '', $code = 0, $templateName = '', $description = '')
 {
     parent::__construct($message, $code, $description);
     $this->templateName = $templateName;
 }
 protected function ArgumentException_2($paramName, Exception $innerException = null)
 {
     parent::SystemException_2($paramName . ' has caused an argument exception.', $innerException);
 }
 /**
  * Displays a system exception in the paackageinstallation exception template.
  * 
  * @param 	SystemException		$e
  */
 protected function showPackageInstallationException(SystemException $e)
 {
     $dbException = false;
     $sqlError = '';
     $sqlErrorNumber = 0;
     $sqlVersion = '';
     if ($e instanceof DatabaseException) {
         $dbException = true;
         $sqlError = $e->getErrorDesc();
         $sqlErrorNumber = $e->getErrorNumber();
         $sqlVersion = $e->getSQLVersion();
     }
     WCF::getTPL()->assign(array('dbException' => $dbException, 'sqlError' => $sqlError, 'sqlErrorNumber' => $sqlErrorNumber, 'sqlVersion' => $sqlVersion, 'errorMessage' => $e->getMessage(), 'errorDescription' => $e->getDescription(), 'phpVersion' => phpversion(), 'wcfVersion' => WCF_VERSION, 'file' => $e->getFile() . ' (' . $e->getLine() . ')', 'errorCode' => $e->getCode(), 'date' => gmdate('m/d/Y h:ia'), 'requestUri' => isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '', 'httpReferer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', 'stackTrace' => $e->getTraceAsString()));
     WCF::getTPL()->append(array('packageName' => ''));
     WCF::getTPL()->display('packageInstallationException');
     exit;
 }
 /**
  * Prints the error page.
  */
 public function show()
 {
     $this->information .= '<b>sql type:</b> ' . StringUtil::encodeHTML($this->getDBType()) . '<br />';
     $this->information .= '<b>sql error:</b> ' . StringUtil::encodeHTML($this->getErrorDesc()) . '<br />';
     $this->information .= '<b>sql error number:</b> ' . StringUtil::encodeHTML($this->getErrorNumber()) . '<br />';
     $this->information .= '<b>sql version:</b> ' . StringUtil::encodeHTML($this->getSQLVersion()) . '<br />';
     parent::show();
 }
Example #11
0
 /**
  * Creates new exception object.
  *
  * @param string $message Exception message
  * @param string $path Path that generated exception.
  * @param \Exception $previous
  */
 public function __construct($message = "", $path = "", \Exception $previous = null)
 {
     parent::__construct($message, 120, '', 0, $previous);
     $this->path = $path;
 }
 public function __construct($message = "", $parameter = "", \Exception $previous = null)
 {
     parent::__construct($message, 100, '', 0, $previous);
     $this->parameter = $parameter;
 }
 protected function NullReferenceException_1($message)
 {
     parent::SystemException_1((string) $message);
 }