Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robust Lua error handling and quarantining #33

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nevkontakte
Copy link
Contributor

This code is in a very draft stage, I'm opening this PR so that you could see the direction I'm going for.

In short my goal can be summarised as LuaIsRunning flag should be used in very few places. The rest should use Lua's native error handling or C++ exceptions for handling errors.

Functions in the runtime namespace provide a robust way to catch and
handle errors triggered by Lua scripts. In future all call to Lua will
go through this API, rather than low-level C API.

The new API can unwind Lua call stack and make a reasonable guess for
which script is responsible for triggering an error and quarantine it
automatically.

For now, it is mostly in proof-of-concept state, handling errors at
script loading stage and in do_often() code. Some functionality is
missing and reporting errors to user is done through Dev Console only.

I also did a bunch of refactoring to the code I had to change, hopefully
making it easier to understand and use more modern C++.
@sparker256
Copy link
Collaborator

I sure wish I could better understood what you are trying to do so we could improve the error handling.

Every once in a while I look at your code but I am afraid it just goes over my head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants