程序包 bsh
类 TargetError
java.lang.Object
java.lang.Throwable
java.lang.Exception
bsh.EvalError
bsh.TargetError
- 所有已实现的接口:
Serializable
TargetError is an EvalError that wraps an exception thrown by the script
(or by code called from the script). TargetErrors indicate exceptions
which can be caught within the script itself, whereas a general EvalError
indicates that the script cannot be evaluated further for some reason.
If the exception is caught within the script it is automatically unwrapped,
so the code looks like normal Java code. If the TargetError is thrown
from the eval() or interpreter.eval() method it may be caught and unwrapped
to determine what exception was thrown.
- 另请参阅:
-
构造器概要
构造器构造器说明TargetError
(String msg, Throwable t, bsh.SimpleNode node, CallStack callstack, boolean inNativeCode) TargetError
(Throwable t, bsh.SimpleNode node, CallStack callstack) -
方法概要
修饰符和类型方法说明boolean
Return true if the TargetError was generated from native code.void
void
printStackTrace
(boolean debug, PrintStream out) void
Generate a printable string showing the wrapped target exception.toString()
Print the error with line number and stack trace.Extended form of print target error.从类继承的方法 bsh.EvalError
getErrorLineNumber, getErrorSourceFile, getErrorText, getMessage, getScriptStackTrace, prependMessage, reThrow, setMessage
从类继承的方法 java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
-
构造器详细资料
-
TargetError
-
TargetError
-
-
方法详细资料
-
getTarget
-
toString
从类复制的说明:EvalError
Print the error with line number and stack trace. -
printStackTrace
public void printStackTrace()- 覆盖:
printStackTrace
在类中Throwable
-
printStackTrace
- 覆盖:
printStackTrace
在类中Throwable
-
printStackTrace
-
printTargetError
Generate a printable string showing the wrapped target exception. If the proxy mechanism is available, allow the extended print to check for UndeclaredThrowableException and print that embedded error. -
xPrintTargetError
Extended form of print target error. This indirection is used to print UndeclaredThrowableExceptions which are possible when the proxy mechanism is available. We are shielded from compile problems by using a bsh script. This is acceptable here because we're not in a critical path... Otherwise we'd need yet another dynamically loaded module just for this. -
inNativeCode
public boolean inNativeCode()Return true if the TargetError was generated from native code. e.g. if the script called into a compiled java class which threw the excpetion. We distinguish so that we can print the stack trace for the native code case... the stack trace would not be useful if the exception was generated by the script. e.g. if the script explicitly threw an exception... (the stack trace would simply point to the bsh internals which generated the exception).
-