cydrobolt / polr

:aerial_tramway: A modern, powerful, and robust URL shortener
https://polrproject.org
GNU General Public License v2.0
4.98k stars 891 forks source link

Show more helpful error messages during setup #202

Open cydrobolt opened 8 years ago

cydrobolt commented 8 years ago

Although APP_DEBUG is set to true during setup, showing stack traces when errors occur, it may be more helpful to catch specific errors (e.g incorrect database error) and show more helpful information.

wedi commented 7 years ago

Hi, yes please!

I’ve just been starting to use Polr and all I got was "Whoops, looks like something went wrong.“. That’s indeed not too helpful…

It took me quite some time to find the culprit. I did not get a meaningful error message before running the manual installer after having deleted the already created database tables. And that wasn’t the first thing I tried. 🙄

Off topic in this issue but maybe good to know: my database user was missing the REFERENCES privilege which is required to create foreign keys since MySQL 5.7.

cydrobolt commented 7 years ago

Unhelpful messages are always the worst :( You can turn on APP_DEBUG=true to display more helpful error messages. By default, APP_DEBUG is off in production mode, after the setup script is ran.

Thanks for the tip regarding the REFERENCES privilege :)

James9074 commented 7 years ago

I might jump on this one - it makes sense to test the DB connection before writing out to the config file, and at least allow the user to try again. I've found while working on the docker implementation that a failed install is both a pain to correct (I have to wipe the storage volume and start over) and hard to debug (there's no immediate understanding that your db connection settings were wrong and easily correctable).

cydrobolt commented 7 years ago

This seems to be relevant: https://stackoverflow.com/questions/33432752/laravel-5-1-checking-a-database-connection

I'll take a look at catching common errors and send a PR