Sethen
Sethen

Reputation: 11348

Debug mode not working as expected in Laravel 4

I am running into a strange issue when trying to add 404 pages to my application.

I have two separate folders that I use for different configurations, one for my local environment and one for production.

So, when I change my "debug" => true in my local configuration, I get a Whoops! as I expect. Changing that option to false shows me a general error message, which I would also expect.

The problem comes about when I try to edit that general error message. The documentation states to add something like this into your app (which I have done):

App::missing(function() {
    return "Not found!";
});

What happens is no matter if my local environment's debug is set to true or false it will always return that message if that code is placed within my application. I want to be able to see a Whoops! on my local environment but on production they should receive a general error message.

Am I doing something wrong here? How can I receive a Whoops! screen to track down bugs locally but send a 404 message in production??

Upvotes: 0

Views: 916

Answers (1)

marcanuy
marcanuy

Reputation: 23962

Detect your environment first and then setup the error you want to show on that env

if (App::environment('local'))
{
    App::missing(function() {
        return "Not found!";
    });
}

Upvotes: 1

Related Questions