public final class JavaScriptException extends JavaScriptExceptionBase
The return value of Throwable.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, Throwable.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(); } }
Modifier | Constructor and Description |
---|---|
|
JavaScriptException(Object e) |
|
JavaScriptException(Object e,
String description) |
protected |
JavaScriptException(String message)
Used for testing instantiations.
|
|
JavaScriptException(String name,
String description) |
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
Returns the original JavaScript message of the exception; may be
null . |
JavaScriptObject |
getException()
Deprecated.
deprecated in favor for
getThrown() and isThrownSet() |
String |
getMessage() |
String |
getName()
Returns the original JavaScript type name of the exception; may be
null . |
Object |
getThrown()
Returns the original thrown object from javascript; may be
null . |
boolean |
isThrownSet()
Returns
true if a thrown object is not set for the exception. |
addSuppressed, fillInStackTrace, getBackingJsObject, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, of, printStackTrace, printStackTrace, setStackTrace, toString
public JavaScriptException(Object e)
e
- the object caught in JavaScript that triggered the exceptionpublic JavaScriptException(Object e, String description)
e
- the object caught in JavaScript that triggered the exceptiondescription
- to include in getMessage(), e.g. at the top of a stack
traceprotected JavaScriptException(String message)
message
- the detail messagepublic boolean isThrownSet()
true
if a thrown object is not set for the exception.public Object getThrown()
null
.public String getDescription()
null
.@Deprecated public JavaScriptObject getException()
getThrown()
and isThrownSet()
null
.public String getMessage()
getMessage
in class Throwable
public String getName()
null
.Copyright © 2016. All rights reserved.