Understand responsibilities of database and backend
An RDBMS is part of the backend, only in  rare cases such as access, you can have both.
Even so the GUI should always (try to) prevent errors in the database, and should control the input of its validity.
Errors happen, should not directly shown to the user. But as you have to debug it, you should show helpful ids or text, that could help fixing things.
For a qualified system you have to go a step further and tell the user how he can fix the problem, for example be editing his input in a correct way.
Check constraints help to debug your code, especially in the beginning, when the GUI is only starting, so no problem will be missed.
Foriegn keys, triggers and events help the database maintaining or do things that the user has no influence over, since the RDBMS is  a background process (nearly always running on a different machine to the end-user's), that shouldn't come to light.