01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdo.tools.enhancer;
12:
13: import java.util.*;
14:
15: import java.lang.reflect.*;
16: import java.io.*;
17:
18: /**
19: * An verification error.
20: * @keep-all
21: */
22: public class VerifyException extends Exception {
23:
24: private Throwable exception;
25:
26: /**
27: * Create new for msg and chained exception.
28: */
29: public VerifyException(String msg, Throwable exception) {
30: super (msg);
31: this .exception = exception;
32: }
33:
34: /**
35: * Create new for msg.
36: */
37: public VerifyException(String msg) {
38: this (msg, null);
39: }
40:
41: /**
42: * Create new for chained exception.
43: */
44: public VerifyException(Throwable exception) {
45: this (exception.getMessage(), exception);
46: }
47:
48: /**
49: * Get the chained (wrapped) exception or null if none.
50: */
51: public Throwable getException() {
52: return exception;
53: }
54:
55: /**
56: * Print our stack trace and that of the chained exception (if any).
57: */
58: public void printStackTrace(PrintStream s) {
59: super .printStackTrace(s);
60: if (exception != null) {
61: s.println("Chained exception:");
62: exception.printStackTrace(s);
63: }
64: }
65:
66: /**
67: * Print our stack trace and that of the chained exception (if any).
68: */
69: public void printStackTrace(PrintWriter s) {
70: super .printStackTrace(s);
71: if (exception != null) {
72: s.println("Chained exception:");
73: exception.printStackTrace(s);
74: }
75: }
76:
77: }
|