[Intl] Added exception handler to command line scripts

This commit is contained in:
Bernhard Schussek 2014-09-12 13:09:09 +02:00
parent 2349839738
commit 9052efc499
1 changed files with 30 additions and 6 deletions

View File

@ -67,3 +67,27 @@ function get_icu_version_from_genrb($genrb)
return $matches[1];
}
set_exception_handler(function (\Exception $exception) {
echo "\n";
$cause = $exception;
$root = true;
while (null !== $cause) {
if (!$root) {
echo "Caused by\n";
}
echo get_class($cause).": ".$cause->getMessage()."\n";
echo "\n";
echo $cause->getFile().":".$cause->getLine()."\n";
foreach ($cause->getTrace() as $trace) {
echo $trace['file'].":".$trace['line']."\n";
}
echo "\n";
$cause = $cause->getPrevious();
$root = false;
}
});