Hi Arbab,
I'm guessing that your module uses an Insert.Before event handler to make sure an added document is not a duplicate of an existing one. For example, you may want to allow only one document of a certain page type to be a child of another page type. If you are enforcing uniqueness in a global event handler like Insert.Before, the most you can do is cancel the event and throw an exception, like this:
e.Cancel();
throw new ApplicationException("There is already a, " + restrictedClassName + ", node under this page.");
However, this doesn't change the error message displayed to a user in the out-of-the-box form for new pages.
Here's a solution:
https://devnet.kentico.com/questions/user-friendly-error-message-from-global-event-handler
Summary: Change the generic error message that is provided to include a link to the Event Log, where the user could see the error. To do that, add a string with the key "General.ErrorDuringSave" as a new resource string in the Localization app. Give the string a new value with a like to the Event Log like this:
An error occurred. Please see <a href="../../../../CMSModules/EventLog/EventLog.aspx">event log</a> for more details.
Mike