Files
tubestation/js/js2/java/WrappedException.java
rogerl@netscape.com 261fd41e46 # NOT A PART OF SEAMONKEY IN ANY WAY
Some new, some old filres copiedfrom Rhino to form start of prototyping
environment for Project Brenda
1999-04-15 18:24:00 +00:00

57 lines
1.4 KiB
Java

/* -*- Mode: java; tab-width: 8 -*-
* Copyright © 1997, 1998 Netscape Communications Corporation,
* All Rights Reserved.
*/
/**
* A wrapper for runtime exceptions.
*
* Used by the JavaScript runtime to wrap and propagate exceptions that occur
* during runtime.
*
* @author Norris Boyd
*/
public class WrappedException extends RuntimeException {
/**
* Create a new exception wrapped around an existing exception.
*
* @param exception the exception to wrap
*/
public WrappedException(Throwable exception) {
super(exception.getMessage());
this.exception = exception.fillInStackTrace();
}
/**
* Get the message for the exception.
*
* Delegates to the wrapped exception.
*/
public String getMessage() {
return "WrappedException of " + exception.toString();
}
/**
* Get the wrapped exception.
*
* @return the exception that was presented as a argument to the
* constructor when this object was created
*/
public Throwable getWrappedException() {
return exception;
}
/**
* Get the wrapped exception.
*
* @return the exception that was presented as a argument to the
* constructor when this object was created
*/
public Object unwrap() {
return exception;
}
private Throwable exception;
}