Better insight on dictionary of traits instantiation
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
Research direction
Inspect traitlets/traitlets.py at lines 2835-2845, focusing on the key and value validation error handlers. Preserve the original TraitError message when constructing the element error, and verify that failures for both keys and values include that context.
Written by the indexing model from the issue text.
Description
In the code, when an instance of traits dictionary is created, if an error occurs in a element construction, the original error message is not used. This makes it more complicated to figure out what went wrong.
It would be nice to add the catch error message to the newly created element error.
if key_trait:
try:
key = key_trait._validate(obj, key)
except TraitError as error:
- self.element_error(obj, key, key_trait, 'Keys')
+ self.element_error(obj, key, key_trait, str(error), 'Keys')
active_value_trait = per_key_override.get(key, value_trait)
if active_value_trait:
try:
v = active_value_trait._validate(obj, v)
except TraitError as error:
- self.element_error(obj, v, active_value_trait, 'Values')
+ self.element_error(obj, v, active_value_trait, str(error), 'Values')
- Dominant language
- Python
- Stars
- 653
- Forks
- 217
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ipython/traitlets
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
All issues in ipython/traitlets
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100