An elegant method to handle exceptions that occur in Apex processes, validations, etc.
The idea here is to create a nice error page (99 in this example), and to redirect the user to that page in case of an exception.
The redirect_url function (see package code below) returns a urls to error page 99.
Page 99 needs a page item named P99_ERROR_MESSAGE (you can change that in the package of course) so you can show the error text to the user.
The code in your Apex processes, validations, etc. would then look something like this:
The [error_X_occurs] section is an example of how to redirect to another error page in your code.
Note the exception handling to prevent an "ORA-20876: Stop APEX Engine" exception.