I'm making a game engine, I've done a c++ hot reload for the scripting and I have one problem. The problem is that if the user makes a mistake and the script crashes, it will crash the engine as well. There are 2 projects, the first one that is an exe (the engine) and the other that is a dll that the user can modify and add whatever he wants for the scripting.
It is posible to catch an error in a dll function in order that my engine does not crash too?
Something like this:
auto item = current_scripts.begin();
for (; item != current_scripts.end(); ++item) {
if (*item != nullptr) {
try {
// I would like to be able to catch all possible errors/exceptions the user might do
throw (*item)->Update();
// this is calling a dll function that the exe does not know what is doing
}
catch(...) {
LOG("Error In Update");
}
}
}