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

refactor: hamilton.exceptions #1181

Open
zilto opened this issue Oct 15, 2024 · 2 comments
Open

refactor: hamilton.exceptions #1181

zilto opened this issue Oct 15, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@zilto
Copy link
Collaborator

zilto commented Oct 15, 2024

Given the increasing complexity of the library, it could be valuable to create custom exceptions rather than generic ValueError and KeyError.

This helps with:

  • readability: the name of the exception is informative EdgeTypeMismatchException, UnknownNodeException, MaterializationError
  • maintainability: the exceptions can be gradually improved by modifying the message in a central place instead of attaching custom messages to individual KeyError around the codebase
  • debugging: maintainers and users can make a better use of the debugger and exception handling to debug and test their code

related:

@zilto zilto added the enhancement New feature or request label Oct 15, 2024
@rahul0906
Copy link

@zilto Imma new to open source but with pretty good experience in ML and python. Seems easy, should I take this up?

@skrawcz
Copy link
Collaborator

skrawcz commented Dec 15, 2024

Thanks @rahul0906 yes it would be, but we haven't figured out alignment on this from a project perspective.

E.g.

  1. we don't special case exceptions - nor do we need to catch and treat different exceptions.
  2. It's really a trade off between a "named exception", and putting the contents of the error in ValueError exception for example...

Did you take a look at the "good first issue" labeled ones? Or?

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

3 participants