Event handler provide custom error message in pop-up
** Custom Error Message in a Pop-up ** I am writing a custom event handler to prevent records from being added/edited inside a module class with custom validation.
I would like to message the user describing the error inside the provided pop-up error modal in the bottom left corner. Right now my module class is throwing an ApplicationException and my message is making it to the Event Log.
There is currently a message notifying the user about the event log entry, but I'm wondering if I can put the message directly into the pop-up?
Environment
- Xperience by Kentico version: [28.2.0]
- .NET version: [8]
- Deployment environment: [SaaS|Azure|VM]
Answers
@jlindsay-bluemodus
I don't think this is possible. The exception is being caught by the platform at such a high/general level - the code displaying the toast doesn't know the cause or context of the error.
If you are building a custom module UI then I'd do the validation at the point that the data is being modified. You'll have some page command or page event lifecycle method that can catch the exception thrown by the event handler and return a more helpful message.
Worst case, you can provide a lot of helpful formatted details in the Event Log error message to guide the user to help resolve the problem.
To answer this question, you have to login first.