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

Better error handling and annotable conditions #45

Open
JessicaTegner opened this issue Apr 12, 2020 · 1 comment
Open

Better error handling and annotable conditions #45

JessicaTegner opened this issue Apr 12, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@JessicaTegner
Copy link
Collaborator

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.

@JessicaTegner JessicaTegner self-assigned this Apr 12, 2020
@JessicaTegner JessicaTegner added this to the Lucia 2.0 milestone Apr 12, 2020
@stale stale bot added the stale label May 12, 2020
@stale stale bot closed this as completed May 19, 2020
@JessicaTegner JessicaTegner reopened this May 28, 2020
@stale stale bot removed the stale label May 28, 2020
@stale stale bot added the stale label Jun 27, 2020
@luciasoftware luciasoftware deleted a comment from stale bot Jun 28, 2020
@luciasoftware luciasoftware deleted a comment from stale bot Jun 28, 2020
@luciasoftware luciasoftware deleted a comment from stale bot Jun 28, 2020
@JessicaTegner JessicaTegner added enhancement New feature or request and removed stale labels Jun 28, 2020
@SeanTolstoyevski
Copy link

I can't understand what StaleBot wants to do.

There are many events.

Can you remove it?
Or it should not create that many entries.

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

No branches or pull requests

2 participants