feat: Exit on first Python callback exception (closes #133)
By default, McRogueFace now exits with code 1 on the first unhandled exception in timer, click, key, or animation callbacks. This prevents repeated exception output that wastes resources in AI-driven development. Changes: - Add exit_on_exception config flag (default: true) - Add --continue-after-exceptions CLI flag to preserve old behavior - Update exception handlers in Timer, PyCallable, and Animation - Signal game loop via McRFPy_API atomic flags - Return proper exit code from main() Before: Timer exceptions repeated 1000+ times until timeout After: Single traceback, clean exit with code 1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9028bf485e
commit
19ded088b0
12 changed files with 160 additions and 8 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "Common.h"
|
||||
#include "Python.h"
|
||||
#include <list>
|
||||
#include <atomic>
|
||||
|
||||
#include "PyFont.h"
|
||||
#include "PyTexture.h"
|
||||
|
|
@ -85,4 +86,10 @@ public:
|
|||
static void triggerSceneChange(const std::string& from_scene, const std::string& to_scene);
|
||||
static void updatePythonScenes(float dt);
|
||||
static void triggerResize(int width, int height);
|
||||
|
||||
// Exception handling - signal game loop to exit on unhandled Python exceptions
|
||||
static std::atomic<bool> exception_occurred;
|
||||
static std::atomic<int> exit_code;
|
||||
static void signalPythonException(); // Called by exception handlers
|
||||
static bool shouldExit(); // Checked by game loop
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue