前言
本文主要给大家介绍了关于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);
}
}
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对硕编程的支持。
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!