Support the ongoing development of Laravel.io →
Configuration Blade
Last updated 2 years ago.
0

You can prevent the default Laravel view from showing if you return your own view from the exception handler.

You can change your App::error handler to return a view:

App::error(function(Exception $exception)
{
    Log::error($exception);

    return Response::view('error.fatal', array(), 500);
});

You will want to also register other handlers below it for different kinds of exceptions. This is all explained in the Laravel documentation: http://laravel.com/docs/errors#handling-errors

A couple of recommendations for this use case though:

  • Don't run a composer update on production. You should commit your composer.lock file and run composer install instead to guarantee you get the same dependencies as you have tested on development (the lock file specifies exact commits to get from Github, rather than a version constaint which could result in you getting new code you didn't expect). Additionally, a composer install is much faster since it's already resolved which dependencies to download and won't need to hit Packagist and do a lot of computation.

  • You should put your app into maintenance mode when deploying. You can run php artisan down and any requests to your app will be handled by the App::down handler in errors.php, so you could do something like:

App::down(function()
{
  return Response::view('error.maintenance', [], 503);
});

Once you're done, you can bring the app back up with php artisan up.

Last updated 2 years ago.
0

@maknz I did what you said and I am still getting the "Whoops, looks like something went wrong." page sometimes when the app gets down for some reason.

I just want to make a custom page/text for when it happens without changing /vendor/laravel/framework/src/Illuminate/Exception/resources/plain.html file. Do you know how to do it?

Last updated 2 years ago.
0

Why not figure out what the issue is first, instead of trying to mask it? I'm sure the log files tell you more than "whoops, looks like something went wrong"?

Last updated 2 years ago.
0

You can prevent the default Laravel view from showing if you return your own view from the exception handler.

But, in my original post:

some types of exceptions supersede my exception handler and show a plain "Whoops, looks like something went wrong." page.

But it looks like artisan down is the best work-around for the biggest of my specific issues.

Last updated 2 years ago.
0

ben-joostens said:

Why not figure out what the issue is first, instead of trying to mask it? I'm sure the log files tell you more than "whoops, looks like something went wrong"?

Because I have a live application with users who need to see a better message than "Whoops, looks like something went wrong."?

Last updated 2 years ago.
0

Hi, you need to put, depends on your development environment the value of the debug array item in true.

If you are using the local environment go to:

app/config/local/app.php

If you are using production environment go to:

app/config/app.php

The results should be:

<?php

return [

/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/

'debug' => true, //for production use false

If you are working with Laravel 5 version, you can find those files in the root config path.

Hope it helps you.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

IOM instanceofmichael Joined 11 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.