Author: glandais Date: 2008-02-20 23:27:26 +0000 (Wed, 20 Feb 2008) New Revision: 1160 Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ExceptionReport.tml Log: Exception handling Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-02-20 23:26:51 UTC (rev 1159) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-02-20 23:27:26 UTC (rev 1160) @@ -17,6 +17,8 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages; +import static org.codelutin.i18n.I18n._; + import java.util.List; import org.apache.tapestry.ioc.Messages; @@ -27,6 +29,7 @@ import org.apache.tapestry.services.ExceptionReporter; import de.hsofttec.t5components.annotations.SetterGetter; +import fr.cemagref.simexplorer.is.exceptions.SimExplorerBusinessException; import fr.cemagref.simexplorer.is.exceptions.SimExplorerException; /** @@ -81,26 +84,23 @@ */ public void reportException(Throwable exceptionReported) { SimExplorerException simException = getException(exceptionReported); - if (simException != null) { + _unknown = true; + if (simException != null && (simException instanceof SimExplorerBusinessException)) { _unknown = false; this.exception = simException; - /* + } + + if (_unknown) { _unknown = true; ExceptionAnalysis analysis = analyzer.analyze(exceptionReported); _stack = analysis.getExceptionInfos(); - */ - } else { - _unknown = true; - ExceptionAnalysis analysis = analyzer.analyze(exceptionReported); - _stack = analysis.getExceptionInfos(); } } /** * Gets the exception. * - * @param exceptionReported - * the exception reported + * @param exceptionReported the exception reported * * @return the exception */ @@ -122,11 +122,12 @@ */ public String getErrorMessage() { if (!_unknown) { - + if (exception instanceof SimExplorerBusinessException) { + return messages.get("simexplorer.ui.web.error.security"); + } return exception.getMessage(); - } - return ""; + return messages.get("simexplorer.ui.web.error.errorMessage"); } /** @@ -136,8 +137,7 @@ */ public boolean getShowPropertyList() { // True if either is non-empty - return !(_info.getPropertyNames().isEmpty() && _info.getStackTrace() - .isEmpty()); + return !(_info.getPropertyNames().isEmpty() && _info.getStackTrace().isEmpty()); } /** Modified: trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ExceptionReport.tml =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ExceptionReport.tml 2008-02-20 23:26:51 UTC (rev 1159) +++ trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ExceptionReport.tml 2008-02-20 23:27:26 UTC (rev 1160) @@ -1,44 +1,43 @@ <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" title="${windowtitle}"> - ${errormessage} + <p>${errormessage}</p> <t:if test="unknown"> - <h1>${message:simexplorer.ui.web.error.unknowException}</h1> - - <p>${message:simexplorer.ui.web.error.errorMessage}</p> + <h2>${message:simexplorer.ui.web.error.unknowException}</h2> - <div t:type="t5components/SlidingPanel" closed="true" subject="${message:simexplorer.ui.web.error.exceptionDetails}"> - <div class="t-exception-report" id="errordetail"> - <ul> - <t:loop source="stack" value="info"> - <li><span class="t-exception-class-name">${info.className}</span> + <div t:type="t5components/SlidingPanel" closed="true" + subject="${message:simexplorer.ui.web.error.exceptionDetails}"> + <div class="t-exception-report" id="errordetail"> + <ul> + <t:loop source="stack" value="info"> + <li><span class="t-exception-class-name">${info.className}</span> - <t:if test="info.message"> - <div class="t-exception-message">${info.message}</div> - </t:if> <t:if test="showPropertyList"> - <dl> - <t:loop source="info.propertyNames" value="propertyName"> - <dt>${propertyName}</dt> - <dd><t:renderobject object="propertyValue" /></dd> - </t:loop> - <t:if test="info.stackTrace"> - <dt>Stack trace</dt> - <dd> - <ul class="t-stack-trace"> - <t:loop source="info.stackTrace" value="frame"> - <li>${frame}</li> - </t:loop> - </ul> - </dd> - </t:if> - </dl> - </t:if></li> - </t:loop> - </ul> - </div> + <t:if test="info.message"> + <div class="t-exception-message">${info.message}</div> + </t:if> <t:if test="showPropertyList"> + <dl> + <t:loop source="info.propertyNames" value="propertyName"> + <dt>${propertyName}</dt> + <dd><t:renderobject object="propertyValue" /></dd> + </t:loop> + <t:if test="info.stackTrace"> + <dt>Stack trace</dt> + <dd> + <ul class="t-stack-trace"> + <t:loop source="info.stackTrace" value="frame"> + <li>${frame}</li> + </t:loop> + </ul> + </dd> + </t:if> + </dl> + </t:if></li> + </t:loop> + </ul> </div> + </div> </t:if>
participants (1)
-
glandais@users.labs.libre-entreprise.org