Customizable error page for each site

Whenever an error take place in a grid or in a style I wanted to redirect to a custom error page for each site instead of the default /portal/error.jsp

How could I achieve this?

Thanks in advance!

 

Using secondary pages

If secondary pages are to be used, a separate secondary page defining a custom primary JSP file(error page) could be implemented. In case of any error, forward the URI to this secondary page...