当前位置: 移动技术网 > IT编程>开发语言>PHP > laravel 5异常错误:FatalErrorException in Handler.php line 38的解决

laravel 5异常错误:FatalErrorException in Handler.php line 38的解决

2017年12月08日  | 移动技术网IT编程  | 我要评论

aliide.sys,蔡明小品全集下载,七龙珠改全集

前言

本文主要给大家介绍了关于laravel5异常错误fatalerrorexception in handler.php line 38的解决,分享出来供大家参考学习,话不多说了,来一起看看详细的介绍。

1、错误提示

fatalerrorexception in handler.php line 38:
uncaught typeerror: argument 1 passed to app\exceptions\handler::report() must be an instance of exception, instance of error given, called in d:\www\activity\vendor\compiled.php on line 1817 and defined in d:\www\activity\app\exceptions\handler.php:38
stack trace:
#0 d:\www\activity\vendor\compiled.php(1817): app\exceptions\handler->report(object(error))
#1 [internal function]: illuminate\foundation\bootstrap\handleexceptions->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);
 }
}

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对移动技术网的支持。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网