On 19.05.2016 13:14, Rasmus Schultz wrote:
> I know that I can dig in via e.g.
> Exception::getStackTrace()[0]["line"] and pull the relevant
> line-number myself, but I'm wondering why the line-number 2 is
> relevant, important or interesting at all?
If you are rethrowing exceptions inside the catch bloc:
for ($code = 0; $code < 2; $code++) {
try {
throw new Exception('Message '.$code, $code);
}
catch (\Exception $e) {
if ($e->getCode() > 0) {
throw $e;
}
}
}
Inside the catch bloc I check whether the Exception code is one that can
be handled at that place (code = 0), if not I rethrow the exception. If
the line property would refer to the place where the exception was
thrown I'd lose information in that case.
Tim
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php