PHP Classes

File: include/core/WAExceptionNT.lib

Recommend this page to a friend!
  Classes of philippe thomassigny  >  Xamboo  >  include/core/WAExceptionNT.lib  >  Download  
File: include/core/WAExceptionNT.lib
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Xamboo
Content management framework to serve Web sites
Author: By
Last change:
Date: 4 years ago
Size: 2,715 bytes
 

 

Contents

Class file image Download
<?php

/*
    WAExceptionNT.lib, DomCore, the WebAbility(r) Core System
    Contains the basic exception to throw when PHP does not supports traits (PHP 5.3 and before)
    (c) 2008-2012 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 <http://www.gnu.org/licenses/>.
*/

/* @UML_Box
|------------------------------------------------------------------|
| WAException: Exception base class.                               |
|------------------------------------------------------------------|
|------------------------------------------------------------------|
|------------------------------------------------------------------|
@End_UML_Box */

namespace core;

class WAException 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;
  }

}

?>

For more information send a message to info at phpclasses dot org.