org.mozilla.javascript
Class WrappedException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--org.mozilla.javascript.EvaluatorException
                          |
                          +--org.mozilla.javascript.WrappedException
All Implemented Interfaces:
java.io.Serializable, Wrapper

public class WrappedException
extends EvaluatorException
implements Wrapper

A wrapper for runtime exceptions. Used by the JavaScript runtime to wrap and propagate exceptions that occur during runtime.

Author:
Norris Boyd
See Also:
Serialized Form

Constructor Summary
WrappedException(java.lang.Throwable exception)
          Create a new exception wrapped around an existing exception.
 
Method Summary
 java.lang.String getLocalizedMessage()
          Gets the localized message.
 java.lang.String getMessage()
          Get the message for the exception.
 java.lang.Throwable getWrappedException()
          Get the wrapped exception.
 java.lang.Object unwrap()
          Get the wrapped exception.
static EvaluatorException wrapException(java.lang.Throwable e)
          Wrap an exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, printStackTrace, printStackTrace, printStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrappedException

public WrappedException(java.lang.Throwable exception)
Create a new exception wrapped around an existing exception.
Parameters:
exception - the exception to wrap
Method Detail

getMessage

public java.lang.String getMessage()
Get the message for the exception. Delegates to the wrapped exception.
Overrides:
getMessage in class java.lang.Throwable

getLocalizedMessage

public java.lang.String getLocalizedMessage()
Gets the localized message. Delegates to the wrapped exception.
Overrides:
getLocalizedMessage in class java.lang.Throwable

getWrappedException

public java.lang.Throwable getWrappedException()
Get the wrapped exception.
Returns:
the exception that was presented as a argument to the constructor when this object was created

unwrap

public java.lang.Object unwrap()
Get the wrapped exception.
Specified by:
unwrap in interface Wrapper
Returns:
the exception that was presented as a argument to the constructor when this object was created

wrapException

public static EvaluatorException wrapException(java.lang.Throwable e)
Wrap an exception. Provides special cases for EvaluatorExceptions (which are returned as-is), and InvocationTargetExceptions (which are unwrapped and passed to a recursive call to wrapException).

Otherwise the exception is simply wrapped in a WrappedException.