Hi, I'm trying to delete a table entry in db with foreign key properties to another table. Correctly, the enty is not deleted. My question, after going back to my javascript code: .error(function (response) { abp.message.error('Error Message', 'Is not deleted'); })
following popup appears in my browser. That is perfect. But before this popup appears, another popup is shown, which is not very userfriendly...Something like: An error occured while updating the entries. See the inner exception for details.... STACK TRACE: System.Data.Entity... and so on..
How can I turn off this message and only show up the abp.message.error?
1 Answer(s)
-
0
Hi,
This detailed exception should bi hidden from users. Can you check these:
- Is customErrors mode="On" in your web.config?
- Have you configured to send all exceptions to clients with this condiguration: Configuration.Modules.AbpWeb().SendAllExceptionsToClients = true; If this is true, all exception details sent to the client.
Even if you fix these, you will get 2 popup: one for "internal server error", second for your message. So, how to fix it? The better solution would be to add an option to ABP javascript API to suppress automatic error dialog (If you create an issue on Github, we can consider it for next versions) Second solution: Wrap your server side code by try-cache and throw new UserFriendlyException("can not delete your entity because...") with your user friendly message. Don't forget to log the actual exception for debugging. Also, in TRY block, call CurrentUnitOfWork.SaveChanges() (or async version of it) as the last line.