We as developers catch exceptions and try to gracefully educate our users on what might have gone wrong and what they are supposed do in the case of an error. If and how we notify the user depends largely on the type of exception as well as the type of SharePoint component i.e. Web Part, Event Handler etc.

Web Parts generally should show error messages within the web part. While event handlers will need to show the errors in a log perhaps. There is also another way, an easy way to show these type of errors.OOTB the WSS API provides a sleek one liner to handle things that go wrong in custom SharePoint components and show the system error page with our custom message.

The one liner:


You can even pass a link so the user has a choice to come back to the active\home page of the site and start again.