org.jruby.Ruby.getRuntimeError()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.jruby.Ruby.getRuntimeError方法的一些代码示例,展示了Ruby.getRuntimeError的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getRuntimeError方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getRuntimeError

Ruby.getRuntimeError介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-core

protected RubyClass getErrorClass(Ruby runtime) {
  return runtime.getRuntimeError();
}

代码示例来源:origin: org.jruby/jruby-complete

protected RubyClass getErrorClass(Ruby runtime) {
  return runtime.getRuntimeError();
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

protected RubyClass getErrorClass(Ruby runtime) {
  return runtime.getRuntimeError();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

protected RubyClass getErrorClass(Ruby runtime) {
  return runtime.getRuntimeError();
}

代码示例来源:origin: org.jruby/jruby-core

public RaiseException newRuntimeError(String message) {
  return newRaiseException(getRuntimeError(), message);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public RaiseException newRuntimeError(String message) {
  return newRaiseException(getRuntimeError(), message);
}

代码示例来源:origin: org.jruby/jruby-complete

public RaiseException newRuntimeError(String message) {
  return newRaiseException(getRuntimeError(), message);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public RaiseException newRuntimeError(String message) {
  return newRaiseException(getRuntimeError(), message);
}

代码示例来源:origin: org.jruby/jruby-complete

/** Creates a new global variable which links to
 * the oldName global variable.
 *
 * <b>WANRING</b> we are already using the 1.7.1 behaviour.
 */
public void alias(String name, String oldName) {
  assert name != null;
  assert oldName != null;
  assert name.startsWith("$");
  assert oldName.startsWith("$");
  GlobalVariable oldVariable = createIfNotDefined(oldName);
  GlobalVariable variable = globalVariables.get(name);
  if (variable != null && oldVariable != variable && variable.isTracing()) {
    throw RaiseException.from(runtime, runtime.getRuntimeError(), "can't alias in tracer");
  }
  globalVariables.put(name, oldVariable);
}

代码示例来源:origin: org.jruby/jruby-core

/** Creates a new global variable which links to
 * the oldName global variable.
 *
 * <b>WANRING</b> we are already using the 1.7.1 behaviour.
 */
public void alias(String name, String oldName) {
  assert name != null;
  assert oldName != null;
  assert name.startsWith("$");
  assert oldName.startsWith("$");
  GlobalVariable oldVariable = createIfNotDefined(oldName);
  GlobalVariable variable = globalVariables.get(name);
  if (variable != null && oldVariable != variable && variable.isTracing()) {
    throw RaiseException.from(runtime, runtime.getRuntimeError(), "can't alias in tracer");
  }
  globalVariables.put(name, oldVariable);
}

代码示例来源:origin: org.jruby/jruby-complete

private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) {
  pw.println("Thread: " + th.getNativeThread().getName());
  pw.println("Stack:");
  ThreadContext tc = th.getContext();
  if (tc != null) {
    RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump");
    exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace()));
    pw.println(Format.MRI.printBacktrace(exc, false));
  } else {
    pw.println("    [no longer alive]");
  }
  pw.println();
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) {
  pw.println("Thread: " + th.getNativeThread().getName());
  pw.println("Stack:");
  ThreadContext tc = th.getContext();
  if (tc != null) {
    RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump");
    exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace(), true));
    pw.println(Format.MRI.printBacktrace(exc, false));
  } else {
    pw.println("    [no longer alive]");
  }
  pw.println();
}

代码示例来源:origin: org.jruby/jruby-core

private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) {
  pw.println("Thread: " + th.getNativeThread().getName());
  pw.println("Stack:");
  ThreadContext tc = th.getContext();
  if (tc != null) {
    RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump");
    exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace()));
    pw.println(Format.MRI.printBacktrace(exc, false));
  } else {
    pw.println("    [no longer alive]");
  }
  pw.println();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) {
  pw.println("Thread: " + th.getNativeThread().getName());
  pw.println("Stack:");
  ThreadContext tc = th.getContext();
  if (tc != null) {
    RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump");
    exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace(), true));
    pw.println(Format.MRI.printBacktrace(exc, false));
  } else {
    pw.println("    [no longer alive]");
  }
  pw.println();
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public RaiseException newFrozenError(String objectType, boolean runtimeError) {
  // TODO: Should frozen error have its own distinct class?  If not should more share?
  return newRaiseException(is1_9() || runtimeError ? getRuntimeError() : getTypeError(), "can't modify frozen " + objectType);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public RaiseException newFrozenError(String objectType, boolean runtimeError) {
  // TODO: Should frozen error have its own distinct class?  If not should more share?
  return newRaiseException(is1_9() || runtimeError ? getRuntimeError() : getTypeError(), "can't modify frozen " + objectType);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

protected void warnCircularRequire(String requireName) {
  runtime.getWarnings().warn("loading in progress, circular require considered harmful - " + requireName);
  // it's a hack for c:rb_backtrace impl.
  // We should introduce new method to Ruby.TraceType when rb_backtrace is widely used not only for this purpose.
  RaiseException ex = new RaiseException(runtime, runtime.getRuntimeError(), null, false);
  String trace = runtime.getInstanceConfig().getTraceType().printBacktrace(ex.getException(), runtime.getPosix().isatty(FileDescriptor.err));
  // rb_backtrace dumps to stderr directly.
  System.err.print(trace.replaceFirst("[^\n]*\n", ""));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

protected void warnCircularRequire(String requireName) {
  runtime.getWarnings().warn("loading in progress, circular require considered harmful - " + requireName);
  // it's a hack for c:rb_backtrace impl.
  // We should introduce new method to Ruby.TraceType when rb_backtrace is widely used not only for this purpose.
  RaiseException ex = new RaiseException(runtime, runtime.getRuntimeError(), null, false);
  String trace = runtime.getInstanceConfig().getTraceType().printBacktrace(ex.getException(), runtime.getPosix().isatty(FileDescriptor.err));
  // rb_backtrace dumps to stderr directly.
  System.err.print(trace.replaceFirst("[^\n]*\n", ""));
}

代码示例来源:origin: org.jruby/jruby-complete

protected static String printBacktraceJRuby(RubyException exception, boolean console) {
  final Ruby runtime = exception.getRuntime();
  final ThreadContext context = runtime.getCurrentContext();
  boolean color = console && runtime.getInstanceConfig().getBacktraceColor();
  // exception line
  String message;
  try {
    message = exception.callMethod(context, "message").toString();
  } catch (org.jruby.exceptions.Exception unused) {
    message = exception.message(context).toString();
  }
  if (exception.getMetaClass() == runtime.getRuntimeError() && message.length() == 0) {
    message = "No current exception";
  }
  String type = exception.getMetaClass().getName();
  return printBacktraceJRuby(exception.getRuntime(), exception.getBacktraceElements(), type, message, color);
}

代码示例来源:origin: org.jruby/jruby-core

protected static String printBacktraceJRuby(RubyException exception, boolean console) {
  final Ruby runtime = exception.getRuntime();
  final ThreadContext context = runtime.getCurrentContext();
  boolean color = console && runtime.getInstanceConfig().getBacktraceColor();
  // exception line
  String message;
  try {
    message = exception.callMethod(context, "message").toString();
  } catch (org.jruby.exceptions.Exception unused) {
    message = exception.message(context).toString();
  }
  if (exception.getMetaClass() == runtime.getRuntimeError() && message.length() == 0) {
    message = "No current exception";
  }
  String type = exception.getMetaClass().getName();
  return printBacktraceJRuby(exception.getRuntime(), exception.getBacktraceElements(), type, message, color);
}

相关文章

微信公众号

最新文章

更多

Ruby类方法