前言
本文主要給大家介紹了關(guān)于laravel5異常錯(cuò)誤FatalErrorException in Handler.php line 38的解決,分享出來(lái)供大家參考學(xué)習(xí),話不多說(shuō)了,來(lái)一起看看詳細(xì)的介紹。
1、錯(cuò)誤提示
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的實(shí)例對(duì)象(對(duì)錯(cuò)誤提示的翻譯……^.^笑cry)
2、解決方案
在提示的錯(cuò)誤地方加上變量$e的實(shí)例判斷,如果不是Exception類(lèi)型,就new一個(gè)
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); } }
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,如果有疑問(wèn)大家可以留言交流,謝謝大家對(duì)的支持。
【網(wǎng)站聲明】本站除付費(fèi)源碼經(jīng)過(guò)測(cè)試外,其他素材未做測(cè)試,不保證完整性,網(wǎng)站上部分源碼僅限學(xué)習(xí)交流,請(qǐng)勿用于商業(yè)用途。如損害你的權(quán)益請(qǐng)聯(lián)系客服QQ:2655101040 給予處理,謝謝支持。