Displaying Custom SharePoint Errors
Recent customer question: how can I show the User some error text without actually having to throw an error?
We all know throwing errors is costly, so if the goal is just to show the end user some “guidance”, actually throwing an error is probably overkill.
Instead, try using the static SPUtility.TransferToErrorPage() method. It has two overloads, allowing it to be called simply with some “guidance” text, or with the text, a URL, and URL text.