]> git.tdb.fi Git - libs/game.git/blobdiff - source/game/stage.cpp
Report which system caused invalid access
[libs/game.git] / 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())));
+                       }
                }
        }