package org.mockejb.interceptor;
import java.io.PrintWriter;
import java.io.StringWriter;
public class AspectException extends RuntimeException {
private Throwable cause;
public AspectException( String message, Throwable cause ) {
super( message +"\nCause:\n" + stackToString( cause ));
this.cause = cause;
}
public AspectException( Throwable cause ) {
this( "", cause);
}
public AspectException( String message ){
super( message );
}
public Throwable getCause() {
return cause;
}
private static String stackToString( Throwable e ) {
StringWriter stringWriter = new StringWriter();
e.printStackTrace( new PrintWriter( stringWriter ) );
return stringWriter.toString();
}
}