public final class

JavaScriptException

extends RuntimeException
java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.lang.RuntimeException
         ↳ com.google.gwt.core.client.JavaScriptException

Class Overview

Any JavaScript exceptions occurring within JSNI methods are wrapped as this class when caught in Java code. The wrapping does not occur until the exception passes out of JSNI into Java. Before that, the thrown object remains a native JavaScript exception object, and can be caught in JSNI as normal.

The return value of getStackTrace() may vary between browsers due to variations in the underlying error-reporting capabilities. When possible, the stack trace will be the stack trace of the underlying error object. If it is not possible to accurately report a stack trace, a zero-length array will be returned. In those cases where the underlying stack trace cannot be determined, fillInStackTrace() can be called in the associated catch block to create a stack trace corresponding to the location where the JavaScriptException object was created.

 try {
   nativeMethod();
 } catch (JavaScriptException e) {
   if (e.getStackTrace().length == 0) {
     e.fillInStackTrace();
   }
 }
 

Summary

Public Constructors
JavaScriptException(Object e)
JavaScriptException(String name, String description)
Protected Constructors
JavaScriptException(String message)
Used for server-side instantiation during JUnit runs.
Public Methods
String getDescription()
Returns the original JavaScript message of the exception; may be null.
JavaScriptObject getException()
Returns the original JavaScript the exception; may be null.
String getMessage()
String getName()
Returns the original JavaScript type name of the exception; may be null.
[Expand]
Inherited Methods
From class java.lang.Throwable
From class java.lang.Object

Public Constructors

public JavaScriptException (Object e)

Parameters
e the object caught in JavaScript that triggered the exception

public JavaScriptException (String name, String description)

Protected Constructors

protected JavaScriptException (String message)

Used for server-side instantiation during JUnit runs. Exceptions are manually marshaled through com.google.gwt.junit.client.impl.ExceptionWrapper objects.

Parameters
message the detail message

Public Methods

public String getDescription ()

Returns the original JavaScript message of the exception; may be null.

public JavaScriptObject getException ()

Returns the original JavaScript the exception; may be null.

public String getMessage ()

public String getName ()

Returns the original JavaScript type name of the exception; may be null.