示例#1
0
  /**
   * For handling all non-Ruby exceptions bubbling out of threads
   *
   * @param exception
   */
  @SuppressWarnings("deprecation")
  public void exceptionRaised(Throwable exception) {
    if (exception instanceof RaiseException) {
      exceptionRaised((RaiseException) exception);
      return;
    }

    assert isCurrent();

    Ruby runtime = getRuntime();
    if (abortOnException(runtime) && exception instanceof Error) {
      // re-propagate on main thread
      runtime.getThreadService().getMainThread().getNativeThread().stop(exception);
    } else {
      // just rethrow on this thread, let system handlers report it
      UnsafeFactory.getUnsafe().throwException(exception);
    }
  }