B
B
Brodyaga19912017-03-11 13:40:21
Laravel
Brodyaga1991, 2017-03-11 13:40:21

How to disable Whoops error output in laravel?

Good afternoon!
Please tell me how to disable the display of the error page in laravel through Whoops?
The script itself works correctly and there are no complaints in the work, but when you open a certain address in the browser, the Whoops error page pops up. (/vendor/laravel/framework/src/Illuminate/Routing/ and further various folders and files with errors).
I didn't find the .env file anywhere!
I tried to disable error output through the .htaccess file, this page does not help anyway.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
Brodyaga1991, 2017-03-11
@Brodyaga1991

The problem was solved by poking.
In /vendor/laravel/framework/src/Illuminate/Exception/ExceptionServiceProvider.php
In line 99: with($whoops = new Run)->allowQuit(false); set true and instead of the error page a white page)!

A
Alexander Aksentiev, 2017-03-11
@Sanasol

turns on production in .env or in configs as a last resort.
maybe that's why the error?

V
Vladislav Nagorny, 2017-03-12
@esvils

I wouldn't go into vendor at all.
It's better to edit app/Exceptions/Handler.php here.
My example

/**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $exception)
    {
        if ($exception instanceof MethodNotAllowedHttpException) {
            if ($request->ajax()) {
                return response()->json(['error' => 'method invaild.'], 404);
            }
            abort(404);
        }
        return parent::render($request, $exception);
    }

Here is the article here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question