Add the Exception error management in CLI (display only the message in normal mode, and display all the trace in expert mode)
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1237 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
15
cli.php
15
cli.php
@@ -160,9 +160,18 @@ $cli->run(); */
|
||||
}
|
||||
|
||||
// TODO : Manage a parameter in the constructor of the class
|
||||
$r = new $class;
|
||||
$s = call_user_func_array(array($r, $method), $argv);
|
||||
var_dump ($s);
|
||||
try
|
||||
{
|
||||
$r = new $class;
|
||||
$s = call_user_func_array(array($r, $method), $argv);
|
||||
var_dump ($s);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
file_put_contents("php://stderr", $e->getMessage()."\n");
|
||||
if ($EXPERT)
|
||||
file_put_contents ("php://stderr", $e->getTraceAsString()."\n");
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user