apache / apache/hamilton

refactor: `hamilton.exceptions`

Open
#1,181 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Jupyter Notebook
Stars
2.6k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

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:
- #1218

Contributor guide

Open the contributing guide

Research direction

Start by reading the hamilton.exceptions module and the related discussion in issue #1218, then locate the generic ValueError and KeyError usages across the library. Done should mean the proposed custom exceptions are defined and adopted consistently, with their messages centralized and covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.