1 /***************************************************************************************
2 * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3 * http://aspectwerkz.codehaus.org *
4 * ---------------------------------------------------------------------------------- *
5 * The software in this package is published under the terms of the LGPL license *
6 * a copy of which has been included with this distribution in the license.txt file. *
7 **************************************************************************************/
8 package org.codehaus.aspectwerkz.compiler;
9
10 import java.io.PrintStream;
11 import java.io.PrintWriter;
12
13 /***
14 * An exception occured during compilation
15 *
16 * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
17 */
18 public class CompileException extends Exception {
19 private Throwable nested;
20
21 public CompileException(String msg, Throwable e) {
22 super(msg);
23 nested = e;
24 }
25
26 public void printStackTrace() {
27 printStackTrace(System.err);
28 }
29
30 public void printStackTrace(PrintWriter writer) {
31 super.printStackTrace(writer);
32 if (nested != null) {
33 writer.println("nested:");
34 nested.printStackTrace(writer);
35 }
36 }
37
38 public void printStackTrace(PrintStream out) {
39 super.printStackTrace(out);
40 if (nested != null) {
41 out.println("nested:");
42 nested.printStackTrace(out);
43 }
44 }
45 }