Package org.jruby
Class RubyException
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyException
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IRubyObject>,InstanceVariables,InternalVariables,IRubyObject,CoreObjectType
- Direct Known Subclasses:
NativeException,RubyFatal,RubyNoMemoryError,RubyScriptError,RubySecurityError,RubySignalException,RubyStandardError,RubySystemExit,RubySystemStackError
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.DataNested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectAllocatorstatic final intstatic final intstatic final intFields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORFields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStampFields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRubyException(Ruby runtime, RubyClass rubyClass) RubyException(Ruby runtime, RubyClass rubyClass, String message) -
Method Summary
Modifier and TypeMethodDescriptionbacktrace_locations(ThreadContext context) voidcaptureBacktrace(ThreadContext context) cause(ThreadContext context) protected RaiseExceptionconstructThrowable(String message) voidLots of MRI objects keep their state in non-lookupable ivars (e:g.static RubyClasscreateExceptionClass(ThreadContext context, RubyClass Object) detailed_message(ThreadContext context) detailed_message(ThreadContext context, IRubyObject opts) detailed_message(ThreadContext context, IRubyObject[] args) exception(IRubyObject[] args) static IRubyObjectexception(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) full_message(ThreadContext context) full_message(ThreadContext context, IRubyObject opts) getCause()Gets a list of all variables in this object.Gets a name list of all variables in this object.initialize(IRubyObject[] args, Block block) initialize(ThreadContext context) initialize(ThreadContext context, IRubyObject arg0) initialize(ThreadContext context, IRubyObject arg0, IRubyObject arg1) inspect(ThreadContext context) inspects an object and return a kind of debug informationmessage(ThreadContext context) static RubyExceptionnewException(Ruby runtime, RubyClass exceptionClass, String msg) static RubyExceptionnewException(ThreadContext context, RubyClass exceptionClass, RubyString message) Construct a new RubyException object from the given exception class and message.static IRubyObjectnewException(ThreadContext context, RubyClass exceptionClass, IRubyObject message) Deprecated.static RubyExceptionnewException(ThreadContext context, RubyClass exceptionClass, IRubyObject... args) Construct a new RubyException object from the given exception class and message.static IRubyObjectop_eqq(ThreadContext context, IRubyObject recv, IRubyObject other) op_equal(ThreadContext context, IRubyObject other) rb_obj_equal Will by default use identity equality to compare objects.voidprepareIntegratedBacktrace(ThreadContext context, StackTraceElement[] javaTrace) Deprecated.voidprintBacktrace(PrintStream errorStream) Print the Ruby exception's backtrace to the given PrintStream.voidprintBacktrace(PrintStream errorStream, int skip) Print the Ruby exception's backtrace to the given PrintStream.static IRubyObjectretrieveBacktrace(RubyException exception) Retrieve the current backtrace object for a given exception.set_backtrace(IRubyObject obj) Deprecated.set_backtrace(ThreadContext context, IRubyObject obj) voidsetBacktrace(ThreadContext context, IRubyObject obj) voidsetCause(IRubyObject cause) voidsetMessage(IRubyObject message) Set the message for this NameError.to_s(ThreadContext context) static IRubyObjectto_tty_p(ThreadContext context, IRubyObject recv) <T> TCoerce this Ruby exception to the requested Java type, if possible.Get a throwable suitable for throwing in Java.Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, equals, finishObjectClass, getNativeClassIndex, hashCode, inspect, op_eqq, puts, specificEval, toRubyString, toStringMethods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, cloneSetup, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dup, dupFinalizer, dupSetup, ensureInstanceVariablesSettable, eql, eql_p, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, freeze, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, hash, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, initialize_copy, initialize_copy, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_cmp, op_match, op_not, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbClone, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, singletonClass, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, to_s, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, dup, marshalLiveVariables
-
Field Details
-
TRACE_HEAD
public static final int TRACE_HEAD- See Also:
-
TRACE_TAIL
public static final int TRACE_TAIL- See Also:
-
TRACE_MAX
public static final int TRACE_MAX- See Also:
-
EXCEPTION_ALLOCATOR
-
-
Constructor Details
-
RubyException
-
RubyException
-
-
Method Details
-
exception
public static IRubyObject exception(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) -
to_tty_p
-
op_eqq
-
constructThrowable
-
createExceptionClass
-
newException
-
newException
public static RubyException newException(ThreadContext context, RubyClass exceptionClass, RubyString message) Construct a new RubyException object from the given exception class and message.- Parameters:
context- the current thread contextexceptionClass- the exception classmessage- the message for the exception- Returns:
- the new exception object
-
newException
public static RubyException newException(ThreadContext context, RubyClass exceptionClass, IRubyObject... args) Construct a new RubyException object from the given exception class and message.- Parameters:
context- the current thread contextexceptionClass- the exception classargs- the arguments for the exception's constructor- Returns:
- the new exception object
-
full_message
-
full_message
-
detailed_message
-
detailed_message
-
detailed_message
-
initialize
- Overrides:
initializein classRubyBasicObject
-
initialize
-
initialize
-
initialize
-
backtrace
-
set_backtrace
Deprecated. -
set_backtrace
-
setBacktrace
-
backtrace_locations
-
exception
-
to_s
- Overrides:
to_sin classRubyBasicObject
-
message
-
inspect
inspects an object and return a kind of debug information- Specified by:
inspectin interfaceIRubyObject- Overrides:
inspectin classRubyBasicObject- Returns:
- A RubyString containing the debug information.
-
op_equal
Description copied from class:RubyBasicObjectrb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems- Specified by:
op_equalin interfaceIRubyObject- Overrides:
op_equalin classRubyBasicObject
-
cause
-
toJava
Coerce this Ruby exception to the requested Java type, if possible. If the requested type is a supertype of RaiseException, the attached throwable will be returned. Otherwise, it will fall back on RubyBasicObject toJava logic.- Specified by:
toJavain interfaceIRubyObject- Overrides:
toJavain classRubyBasicObject- Type Parameters:
T- type- Parameters:
target- the target type to which this object should be converted- Returns:
- the converted result
- See Also:
-
toThrowable
Get a throwable suitable for throwing in Java. The throwable here will be constructed lazily by calling constructThrowable and then cached for future calls. All throwables returned by Ruby exception objects will descend from RaiseException and follow the Throwable hierarchy belowException- Returns:
-
setCause
-
getCause
-
getBacktraceElements
-
captureBacktrace
-
getBacktrace
-
retrieveBacktrace
Retrieve the current backtrace object for a given exception.- Parameters:
exception-- Returns:
- set (or already generated) backtrace, null otherwise
Note: Internal API.
-
copySpecialInstanceVariables
Description copied from class:RubyBasicObjectLots of MRI objects keep their state in non-lookupable ivars (e:g. Range, Struct, etc). This method is responsible for dupping our java field equivalents- Specified by:
copySpecialInstanceVariablesin interfaceIRubyObject- Overrides:
copySpecialInstanceVariablesin classRubyBasicObject
-
printBacktrace
Print the Ruby exception's backtrace to the given PrintStream.- Parameters:
errorStream- the PrintStream to which backtrace should be printed
-
printBacktrace
Print the Ruby exception's backtrace to the given PrintStream. This version accepts a number of lines to skip and is primarily used internally for exception printing where the first line is treated specially.- Parameters:
errorStream- the PrintStream to which backtrace should be printed
-
getMessage
- Returns:
- error message if provided or nil
-
setMessage
Set the message for this NameError.- Parameters:
message- the message
-
getMessageAsJavaString
-
getVariableList
Description copied from class:RubyBasicObjectGets a list of all variables in this object.- Specified by:
getVariableListin interfaceIRubyObject- Overrides:
getVariableListin classRubyBasicObject- Returns:
- a list of all variables (ivar/internal)
-
getVariableNameList
Description copied from class:RubyBasicObjectGets a name list of all variables in this object.- Specified by:
getVariableNameListin interfaceIRubyObject- Overrides:
getVariableNameListin classRubyBasicObject- Returns:
- a list of all variable names (ivar/cvar/constant/internal)
-
prepareIntegratedBacktrace
@Deprecated public void prepareIntegratedBacktrace(ThreadContext context, StackTraceElement[] javaTrace) Deprecated. -
newException
@Deprecated public static IRubyObject newException(ThreadContext context, RubyClass exceptionClass, IRubyObject message) Deprecated.
-