Scripting exception can now wrap the original exception.

This commit is contained in:
hns 2002-11-22 19:04:44 +00:00
parent 0ce0f3f0eb
commit 78875ea8e1

View file

@ -4,49 +4,64 @@
package helma.scripting; package helma.scripting;
import java.io.PrintWriter;
import java.io.PrintStream;
/** /**
* The base class for exceptions thrown by Helma scripting package * The base class for exceptions thrown by Helma scripting package
*/ */
public class ScriptingException extends Exception { public class ScriptingException extends Exception {
Exception wrapped;
/** /**
* Construct a ScriptingException given an error message * Construct a ScriptingException given an error message
*/ */
public ScriptingException (String msg) { public ScriptingException (String msg) {
super (msg); super (msg);
wrapped = null;
} }
/**
* Construct a ScriptingException given an error message
*/
public ScriptingException (Exception w) {
wrapped = w;
}
public String toString () {
if (wrapped == null)
return super.toString ();
else
return wrapped.toString ();
}
public String getMessage () {
if (wrapped == null)
return super.getMessage ();
else
return wrapped.getMessage ();
}
public void printStackTrace () {
if (wrapped == null)
super.printStackTrace ();
else
wrapped.printStackTrace ();
}
public void printStackTrace (PrintStream stream) {
if (wrapped == null)
super.printStackTrace (stream);
else
wrapped.printStackTrace (stream);
}
public void printStackTrace (PrintWriter writer) {
if (wrapped == null)
super.printStackTrace (writer);
else
wrapped.printStackTrace (writer);
}
} }