You can display your custom error message instead of detailed error messages. To enable this option, go to Miscellaneous page -> Error reporting.
Displaying server errors in AJAX mode
From now on you can view the details of server errors that occur in AJAX mode while browsing generated web pages. Here is an example.
There is an Edit page, which is displayed in popup. BeforeEdit event of this page contains an error - division by 0.
When trying to save the updated record, you will see an 'error occurred' message at the top of the page.
Click See details to view extended error information.