最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
laravel 5异常错误:FatalErrorException in Handler.php line 38的解决
时间:2022-06-24 14:40:37 编辑:袖梨 来源:一聚教程网
本文主要给大家介绍了关于laravel5异常错误FatalErrorException in Handler.php line 38的解决,分享出来供大家参考学习,话不多说了,来一起看看详细的介绍。
1、错误提示
FatalErrorException in Handler.php line 38:
Uncaught TypeError: Argument 1 passed to AppExceptionsHandler::report() must be an instance of Exception, instance of Error given, called in D:wwwactivityvendorcompiled.php on line 1817 and defined in D:wwwactivityappExceptionsHandler.php:38
Stack trace:
#0 D:wwwactivityvendorcompiled.php(1817): AppExceptionsHandler->report(Object(Error))
#1 [internal function]: IlluminateFoundationBootstrapHandleExceptions->handleException(Object(Error))
#2 {main}
thrown
原因:D:wwwactivityvendorcompiled.php on line 1817 的变量$e不是Exception的实例对象(对错误提示的翻译……^.^笑cry)
2、解决方案
在提示的错误地方加上变量$e的实例判断,如果不是Exception类型,就new一个
if (!$e instanceof Exception) {
$e = new FatalThrowableError($e);
}
new完之后的样子:
public function handleException($e)
{
if (!$e instanceof Exception) {
$e = new FatalThrowableError($e);
}
$this->getExceptionHandler()->report($e);
if ($this->app->runningInConsole()) {
$this->renderForConsole($e);
} else {
$this->renderHttpResponse($e);
}
}
相关文章
- 小米路由器网络不稳定的原因有哪些(如何解决小米路由器网络不稳定的问题) 08-18
- 吉利汽车2026上半年“量价利齐升”:营收破1700亿 海外销量激增158% 08-18
- 两个结构化数据自检工具的分工:语法校验与效果预览 08-18
- 元旦放假通知模板:清晰简洁的放假安排与温馨祝福 08-18
- 和平精英海岛 2.0 更新奖励是什么 08-18
- excel表格如何利用VBA代码插入交叉矩形图 08-18