1

I'm testing my app to make sure in production it handles errors properly, and one such test is if the mysql or redis services it uses are down.

I'm looking for it to show the 500 error page, but currently its showing a blank page.

I haven't tested this under Laravel 4 yet but the app I'm working on is using Laravel 3 and for production the errors config is set to not show detail and to log instead.

I'd rather it go to the 500 page so at least uses know there's an error in this rare case it may be down.

Does anyone know if this is possible? or is this is what happens in Laravel 4?


[Edit 1]

On investigation, it looks like the MySQL connection doesn't occur until my first db call, which makes and so my first db call is in the start.php file. Now i can wrap this call in a try/catch BUT at this point i can't return Response::error('500'); as its not in a route or controller, and Event::fire(500) doesn't work at this stage either as it needs to read other files after such as the routes file which also has db calls.

So what im now looking for is a way to call the 500 error page directly from the start.php file and just stop the app running at this point, before the routes.php file or any other files are even loaded in.

Any ideas?

Community
  • 1
  • 1
stilliard
  • 762
  • 8
  • 27

1 Answers1

0

This is what happens in Laravel 4, in my limited experience with it anyway.

Look at the server log for a probably answer.

mrpatg
  • 10,001
  • 42
  • 110
  • 169
  • Hi GrapeCamel, thanks for confirming this works in L4, so maybe its a problem with at least my apps current version on L3. I've checked the logs but the logs just point to the mysql error of not being able to connect, its an exception thats thrown, but its thrown in laravel code that connects to the db so im not sure how i'd catch this error and respond with the error page. I can edit my question to show the error output though if that would help track down where we could catch it, but its before any of my code starts i think. – stilliard Feb 18 '14 at 17:23
  • Hi again, i've edited the question a bit now you promting me to look at the logs a bit more made me notice that laravel core doesnt make the connection before the app, its the start.php file with my db call inside that makes that initial mysql connection, Any more help would be great thanks. – stilliard Feb 18 '14 at 17:45