note 61289 added to function.set-error-handler
| From: | errd at osu1 dot php dot net | Date: | Mon, 30 Jan 2006 13:52:23 +0000 |
| Subject: | note 61289 added to function.set-error-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102728@lists.php.net to get a copy of this message | ||
In errors to exceptions conversion below I found some incorrect stuff. File and line properties of
Exception point to line and file where Exception is thrown, but not where real error is occured.
Impoved errors to exceptions converting:
+ Fixed filename of exception handled
+ Fixed code line of exception handled
<?php
class CustomException extends Exception {
public function setLine($line) {
$this->line=$line;
}
public function setFile($file) {
$this->file=$file;
}
}
function exceptionsHandler($code, $string, $file, $line) {
$exception=new CustomException($string, $code);
$exception->setLine($line);
$exception->setFile($file);
throw $exception;
}
set_error_handler('exceptionsHandler', E_ALL);
?>
----
Server IP: 195.222.164.18
Probable Submitter: 213.24.44.50
----
Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61289
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61289&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61289&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61289&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61289&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61289&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61289&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61289&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61289&report=yes
Search -- http://master.php.net/manage/user-notes.php