Properly handle error reporting with method_missing
This commit is contained in:
parent
ab07872857
commit
508729ec77
@ -963,6 +963,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
This_Foist fi(*this, l_params.front());
|
This_Foist fi(*this, l_params.front());
|
||||||
|
|
||||||
|
try {
|
||||||
auto func = boxed_cast<std::shared_ptr<const dispatch::Proxy_Function_Base>>(bv);
|
auto func = boxed_cast<std::shared_ptr<const dispatch::Proxy_Function_Base>>(bv);
|
||||||
try {
|
try {
|
||||||
return (*func)({l_params.begin() + l_num_params, l_params.end()}, l_conversions);
|
return (*func)({l_params.begin() + l_num_params, l_params.end()}, l_conversions);
|
||||||
@ -971,6 +972,11 @@ namespace chaiscript
|
|||||||
} catch (const chaiscript::exception::guard_error &) {
|
} catch (const chaiscript::exception::guard_error &) {
|
||||||
}
|
}
|
||||||
throw chaiscript::exception::dispatch_error({l_params.begin() + l_num_params, l_params.end()}, std::vector<Const_Proxy_Function>{func});
|
throw chaiscript::exception::dispatch_error({l_params.begin() + l_num_params, l_params.end()}, std::vector<Const_Proxy_Function>{func});
|
||||||
|
} catch (const chaiscript::exception::bad_boxed_cast &) {
|
||||||
|
// unable to convert bv into a Proxy_Function_Base
|
||||||
|
throw chaiscript::exception::dispatch_error({l_params.begin() + l_num_params, l_params.end()},
|
||||||
|
std::vector<Const_Proxy_Function>(l_funs.begin(), l_funs.end()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return bv;
|
return bv;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user