当前位置: 首页>>代码示例>>C++>>正文


C++ rb_errinfo函数代码示例

本文整理汇总了C++中rb_errinfo函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_errinfo函数的具体用法?C++ rb_errinfo怎么用?C++ rb_errinfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rb_errinfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: iroffer_ruby_errro

static void iroffer_ruby_errro(int error)
{
  VALUE lasterr;
  VALUE inclass;
  VALUE message;
  VALUE ary;
  long c;

  if (error == 0)
    return;

  lasterr = rb_gv_get("$!"); /* NOTRANSLATE */
  inclass = rb_class_path(CLASS_OF(lasterr));
  message = rb_obj_as_string(lasterr);
  outerror(OUTERROR_TYPE_WARN_LOUD,
           "error ruby_script: class=%s, message=%s",
           RSTRING_PTR(inclass), RSTRING_PTR(message));

  if (!NIL_P(rb_errinfo())) {
    ary = rb_funcall(rb_errinfo(), rb_intern("backtrace"), 0);
    for (c=0; c<RARRAY_LEN(ary); ++c) {
      outerror(OUTERROR_TYPE_WARN_LOUD,
               "backtrace from %s",
               RSTRING_PTR(RARRAY_PTR(ary)[c]));
    }
  }
}
开发者ID:KayDat,项目名称:iroffer-dinoex,代码行数:27,代码来源:dinoex_ruby.c

示例2: uwsgi_ruby_exception

void uwsgi_ruby_exception(void) {

        VALUE lasterr = rb_gv_get("$!");
        VALUE message = rb_obj_as_string(lasterr);

        uwsgi_log("%s\n", RSTRING_PTR(message));
        if(!NIL_P(rb_errinfo())) {
                VALUE ary = rb_funcall(rb_errinfo(), rb_intern("backtrace"), 0);
                int i;
                for (i=0; i<RARRAY_LEN(ary); i++) {
                        uwsgi_log("%s\n", RSTRING_PTR(RARRAY_PTR(ary)[i]));
                }
        }
}
开发者ID:dbhattar,项目名称:uwsgi,代码行数:14,代码来源:rack_plugin.c

示例3: ana_set_extra_attrs_rescue

static G_GNUC_NORETURN VALUE
ana_set_extra_attrs_rescue(VALUE value)
{
    g_slist_free(((struct ana_set_extra_attrs_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:7,代码来源:rbpangoanalysis.c

示例4: protect_proccall

static gboolean
protect_proccall(VALUE receiver, int argc, const VALUE *argv)
{
    funcall_arguments call_args;
    VALUE result;
    int state = 0;

    call_args.receiver = receiver;
    call_args.name = rb_intern("call");
    call_args.argc = argc;
    call_args.argv = argv;
    result = rb_protect(invoke_rb_funcall2, (VALUE)&call_args, &state);
    if (state) {
	VALUE errinfo = rb_errinfo();
	VALUE logger = rb_protect(default_logger, Qfalse, &state);
	if (state == 0 && !NIL_P(logger)) {
	    call_args.receiver = logger;
	    call_args.name = rb_intern("error");
	    call_args.argc = 1;
	    call_args.argv = &errinfo;
	    rb_protect(invoke_rb_funcall2, (VALUE)&call_args, &state);
	}
	return FALSE;
    }
    return RVAL2CBOOL(result);
}
开发者ID:suzuki,项目名称:milter-manager,代码行数:26,代码来源:rb-milter-event-loop.c

示例5: rval2atkstatetype_rescue

static G_GNUC_NORETURN VALUE
rval2atkstatetype_rescue(VALUE value)
{
    g_free(((struct rval2atkstatetype_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbatkstateset.c

示例6: load_encoding

static int
load_encoding(const char *name)
{
    VALUE enclib = rb_sprintf("enc/%s.so", name);
    VALUE verbose = ruby_verbose;
    VALUE debug = ruby_debug;
    VALUE errinfo;
    char *s = RSTRING_PTR(enclib) + 4, *e = RSTRING_END(enclib) - 3;
    int loaded;
    int idx;

    while (s < e) {
	if (!ISALNUM(*s)) *s = '_';
	else if (ISUPPER(*s)) *s = (char)TOLOWER(*s);
	++s;
    }
    FL_UNSET(enclib, FL_TAINT);
    enclib = rb_fstring(enclib);
    ruby_verbose = Qfalse;
    ruby_debug = Qfalse;
    errinfo = rb_errinfo();
    loaded = rb_require_internal(enclib, rb_safe_level());
    ruby_verbose = verbose;
    ruby_debug = debug;
    rb_set_errinfo(errinfo);
    if (loaded < 0 || 1 < loaded) return -1;
    if ((idx = rb_enc_registered(name)) < 0) return -1;
    if (enc_autoload_p(enc_table.list[idx].enc)) return -1;
    return idx;
}
开发者ID:tenderlove,项目名称:ruby,代码行数:30,代码来源:encoding.c

示例7: layout_line_set_runs_rescue

static G_GNUC_NORETURN VALUE
layout_line_set_runs_rescue(VALUE value)
{
    g_slist_free(((struct layout_line_set_runs_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:Vasfed,项目名称:pango,代码行数:7,代码来源:rbpangolayoutline.c

示例8: rbgdk_rval2gdkpixbufglist_rescue

static VALUE
rbgdk_rval2gdkpixbufglist_rescue(VALUE value)
{
    g_list_free(((struct rval2gdkpixbufglist_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgdk.c

示例9: rbgtk_rval2gtkradiotoolbuttongslist_rescue

static VALUE
rbgtk_rval2gtkradiotoolbuttongslist_rescue(VALUE value)
{
    g_slist_free(((struct rbgtk_rval2gtkradiotoolbuttongslist_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtkradiotoolbutton.c

示例10: rbgdk_rval2gdkatoms_rescue

static VALUE
rbgdk_rval2gdkatoms_rescue(VALUE value)
{
    g_free(((struct rbgdk_rval2gdkatoms_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgdk.c

示例11: rbgdk_rval2gdkspans_rescue

static G_GNUC_NORETURN VALUE
rbgdk_rval2gdkspans_rescue(VALUE value)
{
    g_free(((struct rbgdk_rval2gdkspans_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgdkregion.c

示例12: rbg_rval2gtkradioactionentries_rescue

static G_GNUC_NORETURN VALUE
rbg_rval2gtkradioactionentries_rescue(VALUE value)
{
    g_free(((struct rbg_rval2gtkradioactionentries_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtkactiongroup.c

示例13: err_append

static void
err_append(const char *s)
{

    if (rb_vm_parse_in_eval()) {
	VALUE err = rb_errinfo();
	if (err == Qnil) {
	    err = rb_exc_new2(rb_eSyntaxError, s);
	    rb_set_errinfo(err);
	}
	else {
	    VALUE str = rb_obj_as_string(err);

	    rb_str_cat2(str, "\n");
	    rb_str_cat2(str, s);
	    rb_set_errinfo(rb_exc_new3(rb_eSyntaxError, str));
	}
    }
    else {
	VALUE err = rb_vm_current_exception();
	if (err == Qnil) {
	    err = rb_exc_new2(rb_eSyntaxError, "compile error");
	    rb_vm_set_current_exception(err);
	}
	rb_write_error(s);
	rb_write_error("\n");
    }
}
开发者ID:1nueve,项目名称:MacRuby,代码行数:28,代码来源:error.c

示例14: Debug_load

/*
 *  call-seq:
 *    Byebug.debug_load(file, stop = false) -> nil
 *
 *  Same as Kernel#load but resets current context's frames.
 *  +stop+ parameter forces byebug to stop at the first line of code in +file+
 */
static VALUE
Debug_load(int argc, VALUE * argv, VALUE self)
{
  VALUE file, stop, context;
  debug_context_t *dc;
  VALUE status = Qnil;
  int state = 0;

  UNUSED(self);

  if (rb_scan_args(argc, argv, "11", &file, &stop) == 1)
    stop = Qfalse;

  Start(self);

  context = Current_context(self);
  Data_Get_Struct(context, debug_context_t, dc);

  dc->calced_stack_size = 1;

  if (RTEST(stop))
    dc->steps = 1;

  rb_load_protect(file, 0, &state);
  if (0 != state)
  {
    status = rb_errinfo();
    reset_stepping_stop_points(dc);
  }

  return status;
}
开发者ID:Alex-Aralis,项目名称:davey-rails-app,代码行数:39,代码来源:byebug.c

示例15: value_array_from_ruby_rescue

static G_GNUC_NORETURN VALUE
value_array_from_ruby_rescue(VALUE value)
{
    g_value_array_free(((struct value_array_from_ruby_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:ruby-gnome2,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgobj_valuearray.c


注:本文中的rb_errinfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。