]> git.tdb.fi Git - libs/game.git/commitdiff
Report which system caused invalid access
authorMikko Rasa <tdb@tdb.fi>
Sun, 4 Dec 2022 20:14:52 +0000 (22:14 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 4 Dec 2022 20:20:22 +0000 (22:20 +0200)
source/game/stage.cpp

index 43446bd9d8e7af9ba6d03f5fd13d9a49d2e72d42..f8dbd1a5b4fa21074b81d1f0d229d6f8e6ffe026 100644 (file)
@@ -1,4 +1,6 @@
 #include "stage.h"
+#include <msp/debug/demangle.h>
+#include <msp/strings/format.h>
 #include "accessguard.h"
 #include "camera.h"
 #include "root.h"
@@ -62,7 +64,14 @@ void Stage::tick(Time::TimeDelta dt)
                for(const auto &s: systems)
                {
                        System::Activator act(*s);
-                       s->tick(dt);
+                       try
+                       {
+                               s->tick(dt);
+                       }
+                       catch(const invalid_access &exc)
+                       {
+                               throw invalid_access(format("%s by %s", exc.what(), Debug::demangle(typeid(*s).name())));
+                       }
                }
        }