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:
2014-03-22 15:30:19 +00:00
parent d34b80e30d
commit 04e13afe42

15
cli.php
View File

@@ -160,9 +160,18 @@ $cli->run(); */
} }
// TODO : Manage a parameter in the constructor of the class // TODO : Manage a parameter in the constructor of the class
$r = new $class; try
$s = call_user_func_array(array($r, $method), $argv); {
var_dump ($s); $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; exit;
} }
} }