note 109368 added to class.errorexception
| From: | MattKantor | Date: | Tue, 10 Jul 2012 21:51:24 +0000 |
| Subject: | note 109368 added to class.errorexception | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189095@lists.php.net to get a copy of this message | ||
@vog at notjusthosting dot com:
The $errno that comes from set_error_handler is more like the "class" of an error
(E_NOTICE, E_ERROR, etc) than an instance identifier, and internally is more akin to a
"severity level" than an "error code".
It appears to me that the entire reason that ErrorException has a severity property (note that
regular Exceptions do not) is so that there is someplace to keep $errno.
So basically the terminology is confusing but the above code is correct as far as how this class is
intended to be used. Of course there's nothing stopping you from using this number as
ErrorExceptions's code instead of (or in addition to) its severity level, but that will result
in many diverse types of errors sharing the same code (which is probably why the example uses 0 to
indicate that the exception "has no code").
If you *really* want an exception code you'd probably be better off doing something silly like
hashing $errstr so that at least it's unique for different types of errors.
----
Server IP: 64.71.164.2
Probable Submitter: 173.228.88.191
----
Manual Page -- http://www.php.net/manual/en/class.errorexception.php
Edit -- https://master.php.net/note/edit/109368
Del: integrated -- https://master.php.net/note/delete/109368/integrated
Del: useless -- https://master.php.net/note/delete/109368/useless
Del: bad code -- https://master.php.net/note/delete/109368/bad+code
Del: spam -- https://master.php.net/note/delete/109368/spam
Del: non-english -- https://master.php.net/note/delete/109368/non-english
Del: in docs -- https://master.php.net/note/delete/109368/in+docs
Del: other reasons-- https://master.php.net/note/delete/109368
Reject -- https://master.php.net/note/reject/109368
Search -- https://master.php.net/manage/user-notes.php