Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable laravel's built in error screen [duplicate]

I want to disable Laravel's error screen that shows the errors/exceptions with debugging information and functions trace. Mostly because I'm using Laravel as mobile API backend and those responses are harder to read on a mobile device.

Please notice that I want the errors, but not the fancy error page.

Any suggestions?

like image 914
Amin Avatar asked Sep 04 '14 12:09

Amin


1 Answers

Go to Laravel project -> app folder-> config folder -> app.php set

'debug' => false,

This will show a simple error page like Ops! Something went wrong.

Edit:

Laravel App facade provides a way to way catch the exceptions using error method as mentioned in the Laravel docs

App::error(function(Exception $exception)
{
    // handle your exception
});

You can place App::error method in the filters.php

and Laravel is using Symfony to display those pages if you want to further go down. I have not really tried to change this thing, maybe someone will come up with a better answer.

like image 97
Alley Shairu Avatar answered Nov 06 '22 17:11

Alley Shairu