I have a business app with various business forms where users edit data. When a user deletes a record - it shows "FK_ABC_AA.. constraint violated, etc."
I want to do better than that and tell the users something informative.
I've seen some applications just display "You cannot delete this record because other data references it." or something along those lines. I don't like that because it is not enough info.
I can parse error messages from database and display specific human-readable messages but this "smells" before I even do it. Is there preferred way to display such information?
EDIT:
I should mention that:
Application is not crashing in my case. The record is NOT deleted - transaction rolled back. It's just a message that shows..
Deleting associated records is not really practical in this situation. It's a big ERP-like database. So, let's say you created a customer and want to delete it right away - it's OK. But you really don't want to delete customer with associated orders.
Disabling the button also not practical because that will require ongoing modifications to the same spots as I add relationships. Also, I need to do additional querying every time I retrieve record just to see if I can delete it.
Most users DO NOT have permission to even do Delete, so it is not about being nice to everybody.