Skip to content

Improve error message semantics #61

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

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

Conversation

apexDev37
Copy link

Description

This PR introduces a minor patch to enhance error message semantics.

# Current impl.

def initialize(username, api_key):
    if username is None or api_key is None:
        raise RuntimeError("Invalid username and/or api_key")

Not only is the above message misleading, but it's also logically incorrect.
"Invalid" infers some form of malformed input or failed validation, which requires existing data. Here, we only check if both username and api_key exist. This means we raise on the fact of non-existent data, but proceed to tell the user the data is invalid.

Patches

  • Keep RuntimeError but update error message
  • Add reference to official API docs for actionable insight to resolve the error

Update the error message for better clarity.

[Note]
- Add reference to official docs for actionable resolution
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.

1 participant