PHP Classes

File: include/core/WAErrorNT.lib

Recommend this page to a friend!
  Classes of philippe thomassigny   DomCore   include/core/WAErrorNT.lib   Download  
File: include/core/WAErrorNT.lib
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: DomCore
Base library for PHP Web applications
Author: By
Last change: Update of include/core/WAErrorNT.lib
Date: 4 months ago
Size: 2,708 bytes


Class file image Download
<?php /* WAErrorNT.lib, DomCore, the WebAbility(r) Core System Contains the basic error class to throw when PHP does not support traits (PHP 5.3 and before) (c) 2008-2017 Philippe Thomassigny This file is part of DomCore DomCore is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. DomCore 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 General Public License for more details. You should have received a copy of the GNU General Public License along with DomCore. If not, see <>. */ /* @UML_Box |------------------------------------------------------------------| | WAError: Error base class. | |------------------------------------------------------------------| |------------------------------------------------------------------| |------------------------------------------------------------------| @End_UML_Box */ namespace core; class WAError extends \Exception { function __construct($message = null) { parent::__construct($message); } public function __toString() { $message = $this->getMessage(); if (WADebug::getHTMLAPI()) { $error = <<<EOF <table border="1"><tr><td bgcolor="#fdd"><b>ERROR: </b></td><td bgcolor="#fdd">{$message}</td></tr> <tr><td><b>THROWN: </b></td><td>{$this->file} (<b>{$this->line}</b>)</td></tr> <tr><td valign="top"><b>TRACE: </b></td><td valign="top"> EOF; foreach($this->getTrace() as $k => $t) { $error .= (isset($t['file'])?$t['file']:'No file').' (<b>'.(isset($t['line'])?$t['line']:'No line').'</b>) :: calling <font color="blue">'.(isset($t['class'])?$t['class']:'').(isset($t['type'])?$t['type']:'').(isset($t['function'])?$t['function']:'No function').'</font><br />'.PHP_EOL; } $error .= '</td></tr>'.PHP_EOL.'</table>'; return $error; } $error = "ERROR: {$message}".PHP_EOL."THROWN: {$this->file} ({$this->line})".PHP_EOL."TRACE:".PHP_EOL; foreach($this->getTrace() as $k => $t) { $error .= (isset($t['file'])?$t['file']:'No file').' ('.(isset($t['line'])?$t['line']:'No line').') :: calling '.(isset($t['class'])?$t['class']:'').(isset($t['type'])?$t['type']:'').(isset($t['function'])?$t['function']:'No function').PHP_EOL; } return $error; } } ?>