note 109368 deleted from class.errorexception by danbrown

From: Date: Mon, 16 Jul 2012 15:37:15 +0000
Subject: note 109368 deleted from class.errorexception by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189194@lists.php.net to get a copy of this message
Note Submitter: Matt Kantor ---- @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.

« previous php.notes (#189194) next »