-
Notifications
You must be signed in to change notification settings - Fork 15
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
Better error handling and annotable conditions #45
Comments
I can't understand what StaleBot wants to do. There are many events. Can you remove it? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lucia should throw exceptions where appropriate.
Take into account, the following example:
def show_window(*args): # logic here
The end developer would not know, that the above function can only be called, after Lucia has been initialized.
I propose to make common error conditions into annotations like the following (due note, that the name can be changed)
@lucia.conditions.should_be_initialized def show_window(*args): # logic here
And the code for the annotation would look something like this.
def should_be_initialized(func): def __inner__(*args, **kwargs): if initialized == False: # pseudocode to check if lucia has been initialized, if not raise lucia.exceptions.LuciaNotInitializedError raise lucia.exceptions.LuciaNotInitializedError return func return __inner__
The reason for making the conditions annotations, is so people will be able to use them in their own code like the following.
``
import lucia.conditions
@lucia.conditions.should_be_initialized
def game_function(*args):
# this function can only be executed after lucia has been initialized.
``
What do people thing.
The text was updated successfully, but these errors were encountered: