Class RaiseException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Exception

public class RaiseException extends JumpException
See Also:
  • Constructor Details

  • Method Details

    • fillInStackTrace

      public final Throwable fillInStackTrace()
      Description copied from class: JumpException
      This method don't do anything for performance reasons.
      Overrides:
      fillInStackTrace in class JumpException
      See Also:
    • from

      public static RaiseException from(Ruby runtime, RubyClass exceptionClass, String msg)
      Construct a new throwable RaiseException appropriate for the target Ruby exception class. Note that this will produce a RaiseException that has fully prepared for being thrown, including:
      • Populating the stack trace based on the current thread
      • Setting the cause to any currently in-flight exception
      • Setting the thread-local $! "error info" to this exception
      This constructor should not be used to create a RubyException object to be raised on a different thread.
      Parameters:
      runtime - the current JRuby runtime
      exceptionClass - the class of the exception to construct and raise
      msg - a simple message for the exception
      Returns:
      a RaiseException instance appropriate for the target Ruby exception class
    • from

      public static RaiseException from(Ruby runtime, RubyClass exceptionClass, String msg, IRubyObject backtrace)
      Construct a new throwable RaiseException appropriate for the target Ruby exception class.
      Parameters:
      runtime - the current JRuby runtime
      exceptionClass - the class of the exception to construct and raise
      msg - a simple message for the exception
      backtrace - a Ruby object (usually an Array) to use for the exception's backtrace
      Returns:
      a RaiseException instance appropriate for the target Ruby exception class
    • from

      public static RaiseException from(Ruby runtime, RubyClass exceptionClass, IRubyObject... args)
      Construct a new throwable RaiseException appropriate for the target Ruby exception class.
      Parameters:
      runtime - the current JRuby runtime
      exceptionClass - the class of the exception to construct and raise
      args - the arguments for the exception's constructor
      Returns:
      a RaiseException instance appropriate for the target Ruby exception class
    • from

      public static RaiseException from(Ruby runtime, String exceptionPath, String msg)
      Construct a new throwable RaiseException appropriate for the target Ruby exception class.
      Parameters:
      runtime - the current JRuby runtime
      exceptionPath - a string representing the fully-qualified constant path to look up the exception
      msg - a simple message for the exception
      Returns:
      a RaiseException instance appropriate for the target Ruby exception class
    • from

      public static RaiseException from(Ruby runtime, String exceptionPath, String msg, IRubyObject backtrace)
      Construct a new throwable RaiseException appropriate for the target Ruby exception class.
      Parameters:
      runtime - the current JRuby runtime
      exceptionPath - a string representing the fully-qualified constant path to look up the exception
      msg - a simple message for the exception
      backtrace - a Ruby object (usually an Array) to use for the exception's backtrace
      Returns:
      a RaiseException instance appropriate for the target Ruby exception class
    • from

      public static RaiseException from(Ruby runtime, String exceptionPath, IRubyObject... args)
      Construct a new throwable RaiseException appropriate for the target Ruby exception class.
      Parameters:
      runtime - the current JRuby runtimeString exceptionPath
      args - the arguments for the exception's constructor
      Returns:
      a RaiseException instance appropriate for the target Ruby exception class
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable
    • getCause

      public Throwable getCause()
      Overrides:
      getCause in class Throwable
    • getException

      public final RubyException getException()
      Gets the exception
      Returns:
      Returns a RubyException
    • setException

      protected final void setException(RubyException newException)
      Sets the exception
      Parameters:
      newException - The exception to set
    • javaTraceFromRubyTrace

      public static StackTraceElement[] javaTraceFromRubyTrace(RubyStackTraceElement[] trace)
    • createNativeRaiseException

      @Deprecated public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause)
      Deprecated.
    • createNativeRaiseException

      @Deprecated public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause, Member target)
      Deprecated.
    • setException

      @Deprecated protected final void setException(RubyException newException, boolean unused)
      Deprecated.
    • from

      @Deprecated public static RaiseException from(RubyException exception, IRubyObject backtrace)
      Deprecated.