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

Improve error message when client is not yet initialised #3698

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marcuslimdw
Copy link

User.client is only set after open is called. Since having a valid client instance is necessary to test anything, whether client is set is checked in most methods. However, this is done with a simple assert self.client, which gives an opaque AssertionError if the user has indeed forgotten to call open. This PR improves the error message to specifically call that out.

@rodja rodja self-requested a review September 9, 2024 03:30
Copy link
Member

@rodja rodja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great @marcuslimdw. I like showing a better error message. Unfortunately your modification breaks the mypy type checking. Maybe you can modify it to make client a property which can raise the error?

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