PHP's ErrorException class
Well, if you throw a normal
Exception from such a handler, the file name and
line number of the
Exception will be set to match the file and line where the
Exception was actually thrown and not the place where the error happened.
There was no way to extend an Exception class and provide the correct information
$line properties are private and there are no
setters for them, only getters.
ErrorException solves this problem by overriding the
allowing us to pass up to five arguments. From these five arguments, four have
the same meaning as the four arguments passed to the error handler function:
$errline. By passing along these arguments to
ErrorException constructor we get a more meaningful exception from our error