mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
move exception definiton to mrblib
This commit is contained in:
@@ -13,6 +13,44 @@ class Exception
|
||||
end
|
||||
end
|
||||
|
||||
# ISO 15.2.24
|
||||
class ArgumentError < StandardError
|
||||
end
|
||||
|
||||
# ISO 15.2.25
|
||||
class LocalJumpError < StandardError
|
||||
end
|
||||
|
||||
# ISO 15.2.26
|
||||
class RangeError < StandardError
|
||||
end
|
||||
|
||||
class FloatDomainError < RangeError
|
||||
end
|
||||
|
||||
# ISO 15.2.26
|
||||
class RegexpError < StandardError
|
||||
end
|
||||
|
||||
# ISO 15.2.29
|
||||
class TypeError < StandardError
|
||||
end
|
||||
|
||||
# ISO 15.2.31
|
||||
class NameError < StandardError
|
||||
end
|
||||
|
||||
# ISO 15.2.32
|
||||
class NoMethodError < NameError
|
||||
end
|
||||
|
||||
# ISO 15.2.33
|
||||
class IndexError < StandardError
|
||||
end
|
||||
|
||||
class KeyError < IndexError
|
||||
end
|
||||
|
||||
# ISO 15.2.37
|
||||
class ScriptError < Exception
|
||||
end
|
||||
@@ -23,3 +61,4 @@ end
|
||||
|
||||
class NotImplementedError < ScriptError
|
||||
end
|
||||
|
||||
|
||||
-25
@@ -359,9 +359,6 @@ void
|
||||
mrb_init_exception(mrb_state *mrb)
|
||||
{
|
||||
struct RClass *e;
|
||||
struct RClass *eIndexError;
|
||||
struct RClass *eRangeError;
|
||||
struct RClass *eNameError;
|
||||
|
||||
mrb->eException_class = e = mrb_define_class(mrb, "Exception", mrb->object_class); /* 15.2.22 */
|
||||
mrb_define_class_method(mrb, e, "exception", mrb_instance_new, ARGS_ANY());
|
||||
@@ -374,26 +371,4 @@ mrb_init_exception(mrb_state *mrb)
|
||||
|
||||
mrb->eStandardError_class = mrb_define_class(mrb, "StandardError", mrb->eException_class); /* 15.2.23 */
|
||||
mrb->eRuntimeError_class = mrb_define_class(mrb, "RuntimeError", mrb->eStandardError_class); /* 15.2.28 */
|
||||
|
||||
mrb_define_class(mrb, "TypeError", mrb->eStandardError_class); /* 15.2.29 */
|
||||
mrb_define_class(mrb, "ArgumentError", mrb->eStandardError_class); /* 15.2.24 */
|
||||
eIndexError = mrb_define_class(mrb, "IndexError", mrb->eStandardError_class); /* 15.2.33 */
|
||||
eRangeError = mrb_define_class(mrb, "RangeError", mrb->eStandardError_class); /* 15.2.26 */
|
||||
eNameError = mrb_define_class(mrb, "NameError", mrb->eStandardError_class); /* 15.2.31 */
|
||||
|
||||
mrb_define_class(mrb, "NoMethodError", eNameError); /* 15.2.32 */
|
||||
// mrb_define_class(mrb, "SystemCallError", mrb->eStandardError_class); /* 15.2.36 */
|
||||
mrb_define_class(mrb, "LocalJumpError", mrb->eStandardError_class); /* 15.2.25 */
|
||||
|
||||
#ifdef INCLUDE_REGEX
|
||||
mrb_define_class(mrb, "RegexpError", mrb->eStandardError_class); /* 15.2.27 */
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_ENCODING
|
||||
mrb_define_class(mrb, "EncodingError", mrb->eStandardError_class);
|
||||
#endif
|
||||
// mrb_define_class(mrb, "ZeroDivisionError", mrb->eStandardError_class); /* 15.2.30 */
|
||||
|
||||
mrb_define_class(mrb, "FloatDomainError", eRangeError);
|
||||
mrb_define_class(mrb, "KeyError", eIndexError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user