/** * Generate a StopIteration exception. This differs from the normal logic * by avoiding the generation of a backtrace. StopIteration is used by * Enumerator to end an external iteration, and so generating a full * backtrace is usually unreasonable overhead. The flag * -Xstop_iteration.backtrace=true or the property * jruby.stop_iteration.backtrace=true forces all StopIteration exceptions * to generate a backtrace. * * @param message the message for the exception */ public RaiseException newStopIteration(IRubyObject result, String message) { final ThreadContext context = getCurrentContext(); if (message == null) message = STOPIERATION_BACKTRACE_MESSAGE; RubyException ex = RubyStopIteration.newInstance(context, result, message); if (!RubyInstanceConfig.STOPITERATION_BACKTRACE) { ex.forceBacktrace(disabledBacktrace()); } return ex.toThrowable(); }
/** * Generate a StopIteration exception. This differs from the normal logic * by avoiding the generation of a backtrace. StopIteration is used by * Enumerator to end an external iteration, and so generating a full * backtrace is usually unreasonable overhead. The flag * -Xstop_iteration.backtrace=true or the property * jruby.stop_iteration.backtrace=true forces all StopIteration exceptions * to generate a backtrace. * * @param message the message for the exception */ public RaiseException newStopIteration(IRubyObject result, String message) { final ThreadContext context = getCurrentContext(); if (message == null) message = STOPIERATION_BACKTRACE_MESSAGE; RubyException ex = RubyStopIteration.newInstance(context, result, message); if (!RubyInstanceConfig.STOPITERATION_BACKTRACE) { ex.forceBacktrace(disabledBacktrace()); } return ex.toThrowable(); }
private void preRaise(ThreadContext context, IRubyObject backtrace) { context.runtime.incrementExceptionCount(); doSetLastError(context); doCallEventHook(context); if (backtrace == null) { exception.prepareBacktrace(context, nativeException); } else { exception.forceBacktrace(backtrace); } // call Throwable.setStackTrace so that when RaiseException appears nested inside another exception, // Ruby stack trace gets displayed // JRUBY-2673: if wrapping a NativeException, use the actual Java exception's trace as our Java trace if (exception instanceof NativeException) { setStackTrace(((NativeException)exception).getCause().getStackTrace()); } else { setStackTrace(javaTraceFromRubyTrace(exception.getBacktraceElements())); } if (RubyInstanceConfig.LOG_EXCEPTIONS) TraceType.dumpException(exception); }
private void preRaise(ThreadContext context, IRubyObject backtrace) { context.runtime.incrementExceptionCount(); doSetLastError(context); doCallEventHook(context); if (backtrace == null) { exception.prepareBacktrace(context, nativeException); } else { exception.forceBacktrace(backtrace); } // call Throwable.setStackTrace so that when RaiseException appears nested inside another exception, // Ruby stack trace gets displayed // JRUBY-2673: if wrapping a NativeException, use the actual Java exception's trace as our Java trace if (exception instanceof NativeException) { setStackTrace(((NativeException)exception).getCause().getStackTrace()); } else { setStackTrace(javaTraceFromRubyTrace(exception.getBacktraceElements())); } if (RubyInstanceConfig.LOG_EXCEPTIONS) TraceType.dumpException(exception); }
private void preRaise(ThreadContext context, IRubyObject backtrace) { context.runtime.incrementExceptionCount(); doSetLastError(context); doCallEventHook(context); if (RubyInstanceConfig.LOG_EXCEPTIONS) TraceType.logException(exception); // We can only omit backtraces of descendents of Standard error for 'foo rescue nil' if (requiresBacktrace(context)) { if (backtrace == null) { exception.prepareBacktrace(context); } else { exception.forceBacktrace(backtrace); if ( backtrace.isNil() ) return; } setStackTrace(RaiseException.javaTraceFromRubyTrace(exception.getBacktraceElements())); } }
private void preRaise(ThreadContext context, IRubyObject backtrace) { context.runtime.incrementExceptionCount(); doSetLastError(context); doCallEventHook(context); if (RubyInstanceConfig.LOG_EXCEPTIONS) TraceType.logException(exception); // We can only omit backtraces of descendents of Standard error for 'foo rescue nil' if (requiresBacktrace(context)) { if (backtrace == null) { exception.prepareBacktrace(context); } else { exception.forceBacktrace(backtrace); if ( backtrace.isNil() ) return; } setStackTrace(RaiseException.javaTraceFromRubyTrace(exception.getBacktraceElements())); } }
default: RubyException exception = convertToException(context, args[0], args[1]); exception.forceBacktrace(args[2]); raise = exception.toThrowable(); break;
default: RubyException exception = convertToException(context, args[0], args[1]); exception.forceBacktrace(args[2]); raise = exception.toThrowable(); break;