protected String evaluateErrorPage(Map<String, String> errorPages, Throwable rootCause) {

        // get error page by exception type
        String errorPage = errorPages.get(rootCause.getClass().getName());

        // lookup by inheritance hierarchy
        if (errorPage == null) {
            Class<?> throwableClass = rootCause.getClass();
            while (errorPage == null && throwableClass.getSuperclass() != Object.class) {
                throwableClass = throwableClass.getSuperclass();
                errorPage = errorPages.get(throwableClass.getName());
            }
        }

        // get default error page
        if (errorPage == null) {
            errorPage = errorPages.get(null);
        }

        if (errorPage == null) {
            throw new IllegalArgumentException(
                    "No default error page (Status 500 or java.lang.Throwable) and no error page for type \"" + rootCause.getClass() + "\" defined!");
        }

        return errorPage;
    }
Builds the view if not already available. This is mostly required for ViewExpiredException's.

@param context The {@link FacesContext}.
@param throwable The occurred {@link Throwable}.
@param rootCause The root cause.
@return The unwrapped {@link Throwable}.
@throws java.io.IOException If building the view fails.
primefaces/src/main/java/org/primefaces/application/exceptionhandler/PrimeExceptionHandler.java