note 89221 added to class.errorexception
| From: | e dot sand at elisand dot com | Date: | Thu, 26 Feb 2009 19:11:28 +0000 |
| Subject: | note 89221 added to class.errorexception | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151184@lists.php.net to get a copy of this message | ||
If you're looking for a quick one-line way to change all errors in to Exceptions, you can do it
this way:
set_error_handler(create_function('$a, $b, $c, $d', 'throw new ErrorException($b, 0,
$a, $c, $d);'), E_ALL);
using create_function() saves you a few lines of code by embedding it all in to a single line, plus
saves your namespace from a function name that should only ever be called in the event of an error
(this saves from direct invocation).
----
Server IP: 66.207.199.35
Probable Submitter: 99.241.132.158
----
Manual Page -- http://www.php.net/manual/en/class.errorexception.php
Edit -- https://master.php.net/note/edit/89221
Del: integrated -- https://master.php.net/note/delete/89221/integrated
Del: useless -- https://master.php.net/note/delete/89221/useless
Del: bad code -- https://master.php.net/note/delete/89221/bad+code
Del: spam -- https://master.php.net/note/delete/89221/spam
Del: non-english -- https://master.php.net/note/delete/89221/non-english
Del: in docs -- https://master.php.net/note/delete/89221/in+docs
Del: other reasons-- https://master.php.net/note/delete/89221
Reject -- https://master.php.net/note/reject/89221
Search -- https://master.php.net/manage/user-notes.php