From: mh Date: Tue, 29 Jan 2002 21:52:02 +0000 (+0000) Subject: handleUserError for Mir.java. X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=3c87141946087852a07db736bdfe7458e2a32481;p=mir.git handleUserError for Mir.java. --- diff --git a/source/Mir.java b/source/Mir.java index 23b58527..afa63cd3 100755 --- a/source/Mir.java +++ b/source/Mir.java @@ -166,6 +166,9 @@ public class Mir extends AbstractServlet catch (InvocationTargetException e) { handleError( res,res.getWriter(), "ServletModule" + moduleName + " target not found."); } catch (ClassNotFoundException e) { handleError(res, res.getWriter(), "ServletModule" + moduleName + " not found."); } catch (IllegalArgumentException e) { handleError( res,res.getWriter(), "ServletModule" + moduleName + " not found."); } + catch (ServletModuleUserException e) { + handleUserError(res,res.getWriter(), e.getMsg()); + } catch (ServletModuleException e){ handleError(res,res.getWriter(), "ServletException in Module ServletModule" + moduleName + " -- " + e.toString()); } catch (IllegalAccessException e){ handleError(res,res.getWriter(), "No access to class ServletModule" + moduleName + " -- " + e.toString()); } @@ -189,6 +192,21 @@ public class Mir extends AbstractServlet } } + private void handleUserError(HttpServletResponse res,PrintWriter out, String errorString) { + + try { + theLog.printError(errorString); + SimpleHash modelRoot = new SimpleHash(); + modelRoot.put("errorstring", new SimpleScalar(errorString)); + modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar()))); + HTMLTemplateProcessor.process(res,MirConfig.getProp("Mir.UserErrorTemplate"),modelRoot,out); + out.close(); + } + catch (Exception e) { + System.err.println("Fehler in UserErrorTemplate"); + } + + } /** * evaluate login for user / password */