Some very old PHP code originally intended to become an image management tool.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

67 lines
1.2 KiB

<?php
static $oldErrHandler = NULL;
class errException extends Exception
{
protected $errContext;
function __construct ($msg, $no, $file, $line, $context)
{
parent::__construct ($msg, $no);
$this->file = $file;
$this->line = $line;
$this->errContext = $context;
}
function __toString ()
{
$retStr = "Laufzeitfehler (" . $this->code . "): \n";
$retStr .= $this->message . "\n\n";
$retStr .= 'Datei: ' . $this->file . "\n";
$retStr .= 'Zeile: ' . $this->line . "\n";
if ($this->errContext != NULL)
{
$retStr .= "Fehler Context: \n";
$retStr .= print_r ($this->errContext, TRUE) . "\n";
}
$retStr .= "Aufruf Stack: \n";
$retStr .= $this->getTraceAsString () . "\n";
return $retStr;
}
function getErrContext ()
{
return $this->errContext;
}
}
function mapErrToExc ($no, $msg, $file, $line, $con)
{
throw new errException ($msg, $no, $file, $line, $con);
}
function setErrExceptionMapping ()
{
global $oldErrHandler;
if ($oldErrHandler === NULL)
$oldErrHandler = set_error_handler ('mapErrToExc');
}
function resetErrExceptionMapping ()
{
global $oldErrHandler;
if ($oldErrHandler !== NULL)
{
set_error_handler ($oldErrHandler);
$oldErrHandler = NULL;
}
}
?>