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

@ -1,52 +1,67 @@
// ScriptingException.java
// Copyright (c) Hannes Wallnöfer 1998-2001
package helma.scripting;
import java.io.PrintWriter;
import java.io.PrintStream;
/**
* The base class for exceptions thrown by Helma scripting package
*/
public class ScriptingException extends Exception {
Exception wrapped;
/**
* Construct a ScriptingException given an error message
*/
public ScriptingException (String 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);
}
}