Sha256: 5e0f38cf4256e444b163bd5310e55afeb04646633ea5771d2d06cec390d89742

Contents?: true

Size: 1.88 KB

Versions: 66

Compression:

Stored size: 1.88 KB

Contents

/*
** mruby/error.h - Exception class
**
** See Copyright Notice in mruby.h
*/

#ifndef MRUBY_ERROR_H
#define MRUBY_ERROR_H

#include "common.h"

/**
 * MRuby error handling.
 */
MRB_BEGIN_DECL

struct RException {
  MRB_OBJECT_HEADER;
  struct iv_tbl *iv;
};

#define mrb_exc_ptr(v) ((struct RException*)mrb_ptr(v))

MRB_API void mrb_sys_fail(mrb_state *mrb, const char *mesg);
MRB_API mrb_value mrb_exc_new_str(mrb_state *mrb, struct RClass* c, mrb_value str);
#define mrb_exc_new_str_lit(mrb, c, lit) mrb_exc_new_str(mrb, c, mrb_str_new_lit(mrb, lit))
MRB_API mrb_value mrb_make_exception(mrb_state *mrb, mrb_int argc, const mrb_value *argv);
MRB_API mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc);
MRB_API mrb_value mrb_get_backtrace(mrb_state *mrb);
MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, const char *fmt, ...);

/* declaration for fail method */
MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value);

struct RBreak {
  MRB_OBJECT_HEADER;
  struct RProc *proc;
  mrb_value val;
};

/**
 * Protect
 *
 * @mrbgem mruby-error
 */
MRB_API mrb_value mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state);

/**
 * Ensure
 *
 * @mrbgem mruby-error
 */
MRB_API mrb_value mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
                             mrb_func_t ensure, mrb_value e_data);

/**
 * Rescue
 *
 * @mrbgem mruby-error
 */
MRB_API mrb_value mrb_rescue(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
                             mrb_func_t rescue, mrb_value r_data);

/**
 * Rescue exception
 *
 * @mrbgem mruby-error
 */
MRB_API mrb_value mrb_rescue_exceptions(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
                                        mrb_func_t rescue, mrb_value r_data,
                                        mrb_int len, struct RClass **classes);

MRB_END_DECL

#endif  /* MRUBY_ERROR_H */

Version data entries

66 entries across 45 versions & 5 rubygems

Version Path
ruby2d-0.12.1 assets/xcode/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-0.12.1 assets/xcode/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.12.0 assets/xcode/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-0.12.0 assets/xcode/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.11.3 assets/xcode/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.11.3 assets/xcode/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-0.11.2 assets/xcode/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.11.2 assets/xcode/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-rpeck-windows-0.11.1 assets/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-rpeck-windows-0.11.1 assets/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-0.11.1 assets/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-0.11.1 assets/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.11.0 assets/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.11.0 assets/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-0.10.0 assets/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.10.0 assets/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-0.9.5 assets/tvos/MRuby.framework/Headers/mruby/error.h
ruby2d-0.9.5 assets/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.9.4 assets/ios/MRuby.framework/Headers/mruby/error.h
ruby2d-0.9.4 assets/tvos/MRuby.framework/Headers/mruby/error.h