Laravel FatalErrorException但代码似乎还可以

时间:2018-07-12 07:36:04

标签: php laravel laravel-5

我正在使用laravel 5.0抛出FatalErrorException,但没有有用的描述。

我们有一个使用laravel 5.0开发的Web应用程序,其中一小部分是angularJS,我正在研究macbook air 2015。

git项目的一个分支似乎无法在我的机器上运行,尽管其他分支也可以正常工作,并且配置没有变化,代码也没有大的变化。而且,它可以在我同事的机器上工作。

这是返回的错误消息:

local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: 
Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, 
instance of ParseError given, called in Applications/XAMPP/htdocs/myApp/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 73 and defined in /Applications/XAMPP/htdocs/myApp/app/Exceptions/Handler.php:36

这里是Handler.php     

use Exception;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;


use Tymon\JWTAuth\Exceptions\JWTException;

use Tymon\JWTAuth\Exceptions\TokenExpiredException;
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
use Tymon\JWTAuth\Exceptions\TokenBlacklistedException;

use Flash;
use Response;

class Handler extends ExceptionHandler {

    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        'Symfony\Component\HttpKernel\Exception\HttpException'
    ];

    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $e
     * @return void
     */
    public function report(Exception $e)
    {
        parent::report($e);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $e
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $e)
    {
        if ($e instanceof ModelNotFoundException) {
            if ($request->ajax()) {
                return Response::json(null, 403);
            }
            $modelName = str_replace("No query results for model [App\Models\\", "", $e->getMessage());
            $modelName = str_replace("].", "", $modelName);
            Flash::error(trans(lcfirst($modelName) . '.not_found'));
            return redirect()->back();
        }
        if ($e instanceof TokenBlacklistedException) {
        return response()->json(['error' => 'token_blacklisted', 'description' => 'descrizione errore token blacklisted'], $e->    getStatusCode());
        }
        if ($e instanceof TokenInvalidException) {
        return response()->json(['error' => 'token_invalid', 'description' => 'descrizione errore token invalid'], $e->getStatusCode())    ;
        }
        if ($e instanceof TokenExpiredException) {
        return response()->json(['error' => 'token_expired', 'description' => 'descrizione errore token expired'], $e->getStatusCode())    ;
        }
        if ($this->isHttpException($e)) {
            return $this->renderHttpException($e);
        }

        return parent::render($request, $e);
/*
        if ($this->isHttpException($e))
        {
            return $this->renderHttpException($e);
        }
        else
        {
            return parent::render($request, $e);
        }
*/
    }

}

每当我忘记导入时,我都会看到这种类型的通用消息,但这似乎并非如此。我怀疑我在配置中缺少某些内容。

除登录页面和成角度的部分外,所有页面上都会发生错误。

登录后,我重定向到主页,它崩溃了。

任何帮助将不胜感激。

0 个答案:

没有答案
相关问题