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 handling #29

Open
zmievsa opened this issue May 24, 2022 · 1 comment
Open

Improve error handling #29

zmievsa opened this issue May 24, 2022 · 1 comment

Comments

@zmievsa
Copy link
Contributor

zmievsa commented May 24, 2022

There are a few moments in the code base with unhandled exceptions that could make it harder to the users to understand the errors.
Examples:

  • experimental_syntax_encoding.py, line 52 -> transform source could be None. We could either raise a better error here or replace None with lambda s: s.
  • Same file, line 15 -> search_function can return None instead of an encoding. Even though it's incredibly unlikely, mypy/pylance won't like it and in the future we might encounter cases where utf-8 is not available. In that case, adding a single check in the beginning can help the users in that rare case. Additionally, less red text is good :)

I am not touching on examples because they obviously need a bit less error handling.

@aroberge
Copy link
Owner

I've actually been thinking of removing experimental_syntax_encoding.py after working on https://github.com/aroberge/ideas/blob/master/ideas/examples/experimental_syntax.py which I find more versatile. I don't believe that it suffers from the same kind of problems. However, I do need to document it.

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

No branches or pull requests

2 participants