在我的Laravel软件包中,我有以下代码:
try {
$var_msg = "Exception example";
throw new InvalidNameException($var_msg);
}
catch (InvalidNameException $e) {
abort(403, $e->getMessage());
//report($e);Exception Log
}
该错误显示为html错误页面。但是,我想将此错误报告为“糟糕”错误。
答案 0 :(得分:0)
将此代码作为参考。
$whoops = new \Whoops\Run();
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
// Set Whoops as the default error and exception handler used by PHP:
$whoops->register();
throw new \RuntimeException("Oopsie!");