Source code: com/acme/gui/presObjs/ErrorPO1/CommonErrorHander.java
1 /*
2 * Enhydra Java Application Server Project
3 *
4 * The contents of this file are subject to the Enhydra Public License
5 * Version 1.1 (the "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy of the License on
7 * the Enhydra web site ( http://www.enhydra.org/ ).
8 *
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11 * the License for the specific terms governing rights and limitations
12 * under the License.
13 *
14 * The Initial Developer of the Enhydra Application Server is Lutris
15 * Technologies, Inc. The Enhydra Application Server and portions created
16 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17 * All Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * $Id: CommonErrorHander.java,v 1.10.10.1 2000/10/19 17:59:06 jasona Exp $
22 */
23
24
25
26
27 /*
28 * Class that has common error handling code use by all error
29 * handlers.
30 */
31 package com.acme.gui.presObjs.ErrorPO1;
32
33 import com.lutris.appserver.server.httpPresentation.*;
34
35 public class CommonErrorHander {
36 public static void handleTestError(HttpPresentationComms comms,
37 HttpPresentation errorHandler,
38 boolean alwaysStop) throws Exception {
39
40 String errorHandlerClass = errorHandler.getClass().getName();
41 HttpPresentationOutputStream out = comms.response.getOutputStream();
42 out.println("<CENTER>Error handler: " + errorHandlerClass + "<br>");
43
44 boolean last = alwaysStop ||
45 (errorHandlerClass.equals(comms.request.getParameter("LAST_ERROR_HANDLER")));
46
47 if (last) {
48 out.println("The buck stops here: " + comms.exception.getMessage());
49 } else {
50 out.println("Passing up: " + comms.exception.getMessage());
51 }
52 out.println("<br></CENTER><HR>");
53 out.flush();
54 if (!last) {
55 throw (Exception)comms.exception;
56 }
57 }
58
59 public static void handleTestError(HttpPresentationComms comms,
60 HttpPresentation errorHandler) throws Exception {
61 handleTestError(comms, errorHandler, false);
62 }
63 }