Print detailed evaluation errors

This commit is contained in:
momo5502 2019-01-13 22:59:01 +01:00
parent f7384926f0
commit e2d5c93407

View File

@ -95,6 +95,10 @@ void scripting::initialize()
{ {
callback(event->name, arguments); callback(event->name, arguments);
} }
catch (chaiscript::exception::eval_error &e)
{
printf("Failed to handle event: %s\n", e.pretty_print().data());
}
catch (std::exception& e) catch (std::exception& e)
{ {
printf("Failed to handle event: %s\n", e.what()); printf("Failed to handle event: %s\n", e.what());
@ -115,6 +119,10 @@ void scripting::load_scripts() const
{ {
this->chai_->eval_file(script); this->chai_->eval_file(script);
} }
catch (chaiscript::exception::eval_error &e)
{
printf("Failed to load script %s: %s\n", script.data(), e.pretty_print().data());
}
catch (std::exception& e) catch (std::exception& e)
{ {
printf("Failed to load script %s: %s\n", script.data(), e.what()); printf("Failed to load script %s: %s\n", script.data(), e.what());