Package org.mozilla.javascript
Class RhinoException
- java.lang.Object
- 
- java.lang.Throwable
- 
- java.lang.Exception
- 
- java.lang.RuntimeException
- 
- org.mozilla.javascript.RhinoException
 
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 - Direct Known Subclasses:
- EcmaError,- EvaluatorException,- JavaScriptException
 
 public abstract class RhinoException extends java.lang.RuntimeExceptionThe class of exceptions thrown by the JavaScript engine.- See Also:
- Serialized Form
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intcolumnNumber()The column number of the location of the error, or zero if unknown.java.lang.Stringdetails()java.lang.StringgetMessage()ScriptStackElement[]getScriptStack()Get the script stack of this exception as an array ofScriptStackElements.ScriptStackElement[]getScriptStack(int limit, java.lang.String hideFunction)Get the script stack of this exception as an array ofScriptStackElements.java.lang.StringgetScriptStackTrace()Get a string representing the script stack of this exception.java.lang.StringgetScriptStackTrace(int limit, java.lang.String functionName)Get a string representing the script stack of this exception.java.lang.StringgetScriptStackTrace(java.io.FilenameFilter filter)Deprecated.the filter argument is ignored as we are able to recognize script stack elements by our own.static StackStylegetStackStyle()Return the current stack style in use.voidinitColumnNumber(int columnNumber)Initialize the column number of the script statement causing the error.voidinitLineNumber(int lineNumber)Initialize the line number of the script statement causing the error.voidinitLineSource(java.lang.String lineSource)Initialize the text of the source line containing the error.voidinitSourceName(java.lang.String sourceName)Initialize the uri of the script source containing the error.intlineNumber()Returns the line number of the statement causing the error, or zero if not available.java.lang.StringlineSource()The source text of the line causing the error, or null if unknown.voidprintStackTrace(java.io.PrintStream s)voidprintStackTrace(java.io.PrintWriter s)static voidsetStackStyle(StackStyle style)Specify the stack style to use from between three different formats: "Rhino" (the default), "Mozilla", and "V8." See StackStyle for information about each.java.lang.StringsourceName()Get the uri of the script source containing the error, or null if that information is not available.static voiduseMozillaStackStyle(boolean flag)Tell subclasses ofRhinoExceptionwhether to use the Mozilla/Firefox style of rendering script stacks (functionName()@fileName:lineNumber) instead of Rhino's own Java-inspired format (at fileName:lineNumber (functionName)).static booleanusesMozillaStackStyle()Returns true if subclasses ofRhinoExceptionuse the Mozilla/Firefox style of rendering script stacks (functionName()@fileName:lineNumber) instead of Rhino's own Java-inspired format (at fileName:lineNumber (functionName)).
 
- 
- 
- 
Method Detail- 
getMessagepublic final java.lang.String getMessage() - Overrides:
- getMessagein class- java.lang.Throwable
 
 - 
detailspublic java.lang.String details() 
 - 
sourceNamepublic final java.lang.String sourceName() Get the uri of the script source containing the error, or null if that information is not available.
 - 
initSourceNamepublic final void initSourceName(java.lang.String sourceName) Initialize the uri of the script source containing the error.- Parameters:
- sourceName- the uri of the script source responsible for the error. It should not be- null.
- Throws:
- java.lang.IllegalStateException- if the method is called more then once.
 
 - 
lineNumberpublic final int lineNumber() Returns the line number of the statement causing the error, or zero if not available.
 - 
initLineNumberpublic final void initLineNumber(int lineNumber) Initialize the line number of the script statement causing the error.- Parameters:
- lineNumber- the line number in the script source. It should be positive number.
- Throws:
- java.lang.IllegalStateException- if the method is called more then once.
 
 - 
columnNumberpublic final int columnNumber() The column number of the location of the error, or zero if unknown.
 - 
initColumnNumberpublic final void initColumnNumber(int columnNumber) Initialize the column number of the script statement causing the error.- Parameters:
- columnNumber- the column number in the script source. It should be positive number.
- Throws:
- java.lang.IllegalStateException- if the method is called more then once.
 
 - 
lineSourcepublic final java.lang.String lineSource() The source text of the line causing the error, or null if unknown.
 - 
initLineSourcepublic final void initLineSource(java.lang.String lineSource) Initialize the text of the source line containing the error.- Parameters:
- lineSource- the text of the source line responsible for the error. It should not be- null.
- Throws:
- java.lang.IllegalStateException- if the method is called more then once.
 
 - 
getScriptStackTracepublic java.lang.String getScriptStackTrace() Get a string representing the script stack of this exception. If optimization is enabled, this includes java stack elements whose source and method names suggest they have been generated by the Rhino script compiler.- Returns:
- a script stack dump
- Since:
- 1.6R6
 
 - 
getScriptStackTracepublic java.lang.String getScriptStackTrace(int limit, java.lang.String functionName)Get a string representing the script stack of this exception. If optimization is enabled, this includes java stack elements whose source and method names suggest they have been generated by the Rhino script compiler. The optional "limit" parameter limits the number of stack frames returned. The "functionName" parameter will exclude any stack frames "below" the specified function on the stack.- Parameters:
- limit- the number of stack frames returned
- functionName- the name of a function on the stack -- frames below it will be ignored
- Returns:
- a script stack dump
- Since:
- 1.8.0
 
 - 
getScriptStackTrace@Deprecated public java.lang.String getScriptStackTrace(java.io.FilenameFilter filter) Deprecated.the filter argument is ignored as we are able to recognize script stack elements by our own. Use #getScriptStackTrace() instead.Get a string representing the script stack of this exception.- Parameters:
- filter- ignored
- Returns:
- a script stack dump
- Since:
- 1.6R6
 
 - 
getScriptStackpublic ScriptStackElement[] getScriptStack() Get the script stack of this exception as an array ofScriptStackElements. If optimization is enabled, this includes java stack elements whose source and method names suggest they have been generated by the Rhino script compiler.- Returns:
- the script stack for this exception
- Since:
- 1.7R3
 
 - 
getScriptStackpublic ScriptStackElement[] getScriptStack(int limit, java.lang.String hideFunction) Get the script stack of this exception as an array ofScriptStackElements. If optimization is enabled, this includes java stack elements whose source and method names suggest they have been generated by the Rhino script compiler.- Parameters:
- limit- the number of stack frames returned, or -1 for unlimited
- hideFunction- the name of a function on the stack -- frames below it will be ignored, or null
- Returns:
- the script stack for this exception
- Since:
- 1.8.0
 
 - 
printStackTracepublic void printStackTrace(java.io.PrintWriter s) - Overrides:
- printStackTracein class- java.lang.Throwable
 
 - 
printStackTracepublic void printStackTrace(java.io.PrintStream s) - Overrides:
- printStackTracein class- java.lang.Throwable
 
 - 
usesMozillaStackStylepublic static boolean usesMozillaStackStyle() Returns true if subclasses ofRhinoExceptionuse the Mozilla/Firefox style of rendering script stacks (functionName()@fileName:lineNumber) instead of Rhino's own Java-inspired format (at fileName:lineNumber (functionName)).- Returns:
- true if stack is rendered in Mozilla/Firefox style
- Since:
- 1.7R3
- See Also:
- ScriptStackElement
 
 - 
useMozillaStackStylepublic static void useMozillaStackStyle(boolean flag) Tell subclasses ofRhinoExceptionwhether to use the Mozilla/Firefox style of rendering script stacks (functionName()@fileName:lineNumber) instead of Rhino's own Java-inspired format (at fileName:lineNumber (functionName)). Use "setStackStyle" to select between more than just the "Mozilla" and "Rhino" formats.- Parameters:
- flag- whether to render stacks in Mozilla/Firefox style
- Since:
- 1.7R3
- See Also:
- ScriptStackElement
 
 - 
setStackStylepublic static void setStackStyle(StackStyle style) Specify the stack style to use from between three different formats: "Rhino" (the default), "Mozilla", and "V8." See StackStyle for information about each.- Parameters:
- style- the style to select -- an instance of the StackStyle class
- Since:
- 1.8.0
- See Also:
- StackStyle
 
 - 
getStackStylepublic static StackStyle getStackStyle() Return the current stack style in use. Return the current stack style in use.
 
- 
 
-