01: package dalma;
02:
03: import java.util.logging.Level;
04: import java.util.logging.Logger;
05:
06: /**
07: * Handles uncaught exceptions thrown from conversations.
08: *
09: * <p>
10: * Conversations may throw {@link RuntimeException} because
11: * of a programming error, or it may throw {@link Error}
12: * because of more serious problem. Installing an {@link ErrorHandler}
13: * to an {@link Engine} allows the calling application to catch
14: * and report any such problem.
15: *
16: * @see Engine#setErrorHandler(ErrorHandler)
17: *
18: * @author Kohsuke Kawaguchi
19: */
20: public interface ErrorHandler {
21: /**
22: * This method is invoked by the engine every time
23: * a conversation throws an uncaught exception.
24: *
25: * @param t
26: * always non-null.
27: */
28: void onError(Throwable t);
29:
30: /**
31: * Default error handler that sends the error to {@link Logger}.
32: */
33: public static final ErrorHandler DEFAULT = new ErrorHandler() {
34: public void onError(Throwable t) {
35: Logger.getAnonymousLogger().log(Level.SEVERE,
36: "a conversation reported an error", t);
37: }
38: };
39: }
|