01: package org.jzonic.jlo.error;
02:
03: /**
04: * The ErrorHandler is used when an exception occurs in the framework. The
05: * exception must not be thrown back to the application that uses jLo.
06: * Therefore we use our own ErrorHandler that sends the Exception together with
07: * a message to System.out.
08: *
09: *@author Andreas Mecky
10: *@author Terry Dye
11: *@created 9. März 2002
12: *@version 1.0
13: */
14: public class ConsoleErrorReporter implements ErrorReporter {
15: /**
16: * Constructor for the ErrorHandler object
17: */
18: public ConsoleErrorReporter() {
19: }
20:
21: /**
22: * This method writes a message
23: *
24: *@param message the message that will be written to System.out
25: */
26: public void reportError(String message) {
27: reportError(message, null);
28: }
29:
30: /**
31: * This method writes a message together with the StackTrace from the
32: * exception
33: *
34: *@param message the message that will be written
35: *@param thrown the excption
36: */
37: public void reportError(String message, Throwable thrown) {
38: System.out.println(message);
39: if (thrown != null) {
40: thrown.printStackTrace();
41: }
42: }
43:
44: /**
45: * This method writes the StackTrace from the exception
46: *
47: *@param thrown the excption
48: */
49: public void reportError(Throwable thrown) {
50: thrown.printStackTrace();
51: }
52: }
|