public static String getExceptionMessage(final AbstractSecuredBasePage securedPage, final ProjectForgeException exception,
final boolean doLog)
{
// Feedbackpanel!
if (exception instanceof UserException) {
final UserException ex = (UserException) exception;
if (doLog == true) {
log.info(ex.toString() + ExceptionHelper.getFilteredStackTrace(ex, ONLY4NAMESPACE));
}
return securedPage.translateParams(ex.getI18nKey(), ex.getMsgParams(), ex.getParams());
} else if (exception instanceof InternalErrorException) {
final InternalErrorException ex = (InternalErrorException) exception;
if (doLog == true) {
log.info(ex.toString() + ExceptionHelper.getFilteredStackTrace(ex, ONLY4NAMESPACE));
}
return securedPage.translateParams(ex.getI18nKey(), ex.getMsgParams(), ex.getParams());
} else if (exception instanceof AccessException) {
final AccessException ex = (AccessException) exception;
if (doLog == true) {
log.info(ex.toString() + ExceptionHelper.getFilteredStackTrace(ex, ONLY4NAMESPACE));
}
if (ex.getParams() != null) {
return securedPage.getLocalizedMessage(ex.getI18nKey(), ex.getParams());
} else {
return securedPage.translateParams(ex.getI18nKey(), ex.getMessageArgs(), ex.getParams());
}
}
throw new UnsupportedOperationException("For developer: Please add unknown ProjectForgeException here!", exception);
}