aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/ScriptSystem.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-22 16:12:31 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-22 16:12:31 +0100
commit7e12ebdf945d40d6f11872cf5852c9bb54d1864f (patch)
treed81f4661e2fd47f487cf0c9627baa1e21dc45b37 /src/crepe/system/ScriptSystem.cpp
parent61148c757a1f742ff09e40e5347e74e638c7371c (diff)
big WIP
Diffstat (limited to 'src/crepe/system/ScriptSystem.cpp')
-rw-r--r--src/crepe/system/ScriptSystem.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/crepe/system/ScriptSystem.cpp b/src/crepe/system/ScriptSystem.cpp
index ed0c7cc..4cce42b 100644
--- a/src/crepe/system/ScriptSystem.cpp
+++ b/src/crepe/system/ScriptSystem.cpp
@@ -32,10 +32,19 @@ void ScriptSystem::update(
if (script == nullptr) continue;
if (!script->initialized) {
- script->init();
- script->initialized = true;
+ try {
+ script->init();
+ script->initialized = true;
+ } catch (const exception & e) {
+ Log::logf(Log::Level::WARNING, "Uncaught exception in {} init: {}", behavior_script.name, e.what());
+ }
}
- (*script.*update_function)(delta_time);
+ try {
+ (*script.*update_function)(delta_time);
+ } catch (const exception & e) {
+ // TODO: print if it is fixed/frame update
+ Log::logf(Log::Level::WARNING, "Uncaught exception in {}: {}", behavior_script.name, e.what());
+ }
}
}