final Page errorPage;
if (e instanceof UnauthorizedInstantiationException) {
errorParameters.add("errorMessage",
new StringResourceModel("unauthorizedInstantiationException", null).getString());
errorPage = new ErrorPage(errorParameters);
} else if (e.getCause() instanceof AccessControlException) {
errorParameters.add("errorMessage", new StringResourceModel("accessControlException", null).getString());
errorPage = new ErrorPage(errorParameters);
} else if (e instanceof PageExpiredException || !(SyncopeSession.get()).isAuthenticated()) {
errorParameters.add("errorMessage", new StringResourceModel("pageExpiredException", null).getString());
errorPage = new ErrorPage(errorParameters);
} else if (e.getCause() instanceof BadRequestException || e.getCause() instanceof WebServiceException
|| e.getCause() instanceof SyncopeClientException) {
errorParameters.add("errorMessage", new StringResourceModel("restClientException", null).getString());
errorPage = new ErrorPage(errorParameters);
} else {
// redirect to default Wicket error page
errorPage = new ExceptionErrorPage(e, null);
}