Add runtime_error support, for throwing a normal std::exception. Also, move bootstrap for Dynamic_Object into its proper place.
This commit is contained in:
parent
b0041217b0
commit
6a47846b84
@ -8,6 +8,7 @@
|
||||
#define __bootstrap_hpp__
|
||||
|
||||
#include "dispatchkit.hpp"
|
||||
#include "dynamic_object.hpp"
|
||||
#include "register_function.hpp"
|
||||
|
||||
namespace chaiscript
|
||||
@ -666,6 +667,15 @@ namespace chaiscript
|
||||
m->add(user_type<Proxy_Function>(), "function");
|
||||
m->add(user_type<std::exception>(), "exception");
|
||||
|
||||
m->add(user_type<std::runtime_error>(), "runtime_error");
|
||||
m->add(constructor<std::runtime_error (const std::string &)>(), "runtime_error");
|
||||
m->add(fun(boost::function<std::string (const std::runtime_error &)>(&what)), "what");
|
||||
|
||||
m->add(user_type<Dynamic_Object>(), "Dynamic_Object");
|
||||
copy_constructor<Dynamic_Object>("Dynamic_Object", m);
|
||||
|
||||
|
||||
|
||||
basic_constructors<bool>("bool", m);
|
||||
oper_assign<std::string>(m);
|
||||
oper_assign<bool>(m);
|
||||
|
@ -465,9 +465,6 @@ namespace chaiscript
|
||||
new Dynamic_Proxy_Function(boost::bind(&ChaiScript_System<Eval_Engine>::internal_eval, boost::ref(*this), _1), 1)), "eval");
|
||||
|
||||
|
||||
engine.add(user_type<Dynamic_Object>(), "Dynamic_Object");
|
||||
engine.add(chaiscript::bootstrap::copy_constructor<Dynamic_Object>("Dynamic_Object"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
6
unittests/runtime_error.chai
Normal file
6
unittests/runtime_error.chai
Normal file
@ -0,0 +1,6 @@
|
||||
try {
|
||||
throw(runtime_error("error"))
|
||||
}
|
||||
catch(e) {
|
||||
print(e.what())
|
||||
}
|
1
unittests/runtime_error.txt
Normal file
1
unittests/runtime_error.txt
Normal file
@ -0,0 +1 @@
|
||||
error
|
Loading…
x
Reference in New Issue
Block a user