01: package dalma.impl;
02:
03: /**
04: * Persistable {@link Exception} used to capture exceptions.
05: *
06: * @author Kohsuke Kawaguchi
07: */
08: public class RecordableException extends Throwable {
09: private final String className;
10:
11: private RecordableException(Throwable base) {
12: super (base.getMessage(), create(base.getCause()));
13: className = base.getClass().getName();
14: setStackTrace(base.getStackTrace());
15: }
16:
17: public static RecordableException create(Throwable t) {
18: if (t == null)
19: return null;
20: else
21: return new RecordableException(t);
22: }
23:
24: /**
25: * Override to print the original class name.
26: */
27: public String toString() {
28: String s = className;
29: String message = getLocalizedMessage();
30: return (message != null) ? (s + ": " + message) : s;
31: }
32: }
|