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

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

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

Ruby.getRuntimeError介绍

暂无

代码示例

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

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

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

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

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

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

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

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

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

  1. public RaiseException newRuntimeError(String message) {
  2. return newRaiseException(getRuntimeError(), message);
  3. }

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

  1. public RaiseException newRuntimeError(String message) {
  2. return newRaiseException(getRuntimeError(), message);
  3. }

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

  1. public RaiseException newRuntimeError(String message) {
  2. return newRaiseException(getRuntimeError(), message);
  3. }

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

  1. public RaiseException newRuntimeError(String message) {
  2. return newRaiseException(getRuntimeError(), message);
  3. }

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

  1. /** Creates a new global variable which links to
  2. * the oldName global variable.
  3. *
  4. * <b>WANRING</b> we are already using the 1.7.1 behaviour.
  5. */
  6. public void alias(String name, String oldName) {
  7. assert name != null;
  8. assert oldName != null;
  9. assert name.startsWith("$");
  10. assert oldName.startsWith("$");
  11. GlobalVariable oldVariable = createIfNotDefined(oldName);
  12. GlobalVariable variable = globalVariables.get(name);
  13. if (variable != null && oldVariable != variable && variable.isTracing()) {
  14. throw RaiseException.from(runtime, runtime.getRuntimeError(), "can't alias in tracer");
  15. }
  16. globalVariables.put(name, oldVariable);
  17. }

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

  1. /** Creates a new global variable which links to
  2. * the oldName global variable.
  3. *
  4. * <b>WANRING</b> we are already using the 1.7.1 behaviour.
  5. */
  6. public void alias(String name, String oldName) {
  7. assert name != null;
  8. assert oldName != null;
  9. assert name.startsWith("$");
  10. assert oldName.startsWith("$");
  11. GlobalVariable oldVariable = createIfNotDefined(oldName);
  12. GlobalVariable variable = globalVariables.get(name);
  13. if (variable != null && oldVariable != variable && variable.isTracing()) {
  14. throw RaiseException.from(runtime, runtime.getRuntimeError(), "can't alias in tracer");
  15. }
  16. globalVariables.put(name, oldVariable);
  17. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. protected static String printBacktraceJRuby(RubyException exception, boolean console) {
  2. final Ruby runtime = exception.getRuntime();
  3. final ThreadContext context = runtime.getCurrentContext();
  4. boolean color = console && runtime.getInstanceConfig().getBacktraceColor();
  5. // exception line
  6. String message;
  7. try {
  8. message = exception.callMethod(context, "message").toString();
  9. } catch (org.jruby.exceptions.Exception unused) {
  10. message = exception.message(context).toString();
  11. }
  12. if (exception.getMetaClass() == runtime.getRuntimeError() && message.length() == 0) {
  13. message = "No current exception";
  14. }
  15. String type = exception.getMetaClass().getName();
  16. return printBacktraceJRuby(exception.getRuntime(), exception.getBacktraceElements(), type, message, color);
  17. }

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

  1. protected static String printBacktraceJRuby(RubyException exception, boolean console) {
  2. final Ruby runtime = exception.getRuntime();
  3. final ThreadContext context = runtime.getCurrentContext();
  4. boolean color = console && runtime.getInstanceConfig().getBacktraceColor();
  5. // exception line
  6. String message;
  7. try {
  8. message = exception.callMethod(context, "message").toString();
  9. } catch (org.jruby.exceptions.Exception unused) {
  10. message = exception.message(context).toString();
  11. }
  12. if (exception.getMetaClass() == runtime.getRuntimeError() && message.length() == 0) {
  13. message = "No current exception";
  14. }
  15. String type = exception.getMetaClass().getName();
  16. return printBacktraceJRuby(exception.getRuntime(), exception.getBacktraceElements(), type, message, color);
  17. }

相关文章

Ruby类方法