Improve errors from `convert` function
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in cyprecice/cyprecice.pyx at the convert function, lines 15-24, and reproduce the failure by passing an Enum member where a string is expected. Update the error behavior so it identifies the received type and supported types, then verify the resulting message against the Interface example in the issue.
Written by the indexing model from the issue text.
Description
The error return by the convert function is not helpful at the moment. I stumbled over this when I organized my participant names in an Enum
class ParticipantNames(Enum):
MASS_LEFT = "Mass-Left"
MASS_RIGHT = "Mass-Right"
One has to pass, for example, ParticipantNames.MASS_LEFT.value to the API. But I forgot the .values part, which led to an errors similar to
>>> precice.Interface(1,2,3,4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cyprecice/cyprecice.pyx", line 87, in cyprecice.Interface.__cinit__
File "cyprecice/cyprecice.pyx", line 24, in cyprecice.convert
TypeError: Could not convert.
I think it would be good to tell the user which type was received from the API and which types are supported here. If I would have known that I provided a <enum 'ParticipantNames'> instead of a <class 'str'> this would have helped me a lot debugging.
- Dominant language
- Cython
- Stars
- 30
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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 precice/python-bindings
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
precice/python-bindings#258 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
precice/python-bindings#255 ·
-
good first issue
Difficulty 3/5 1-2 days Newbie friendliness 68/100
precice/python-bindings#248 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
precice/python-bindings#238 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
precice/python-bindings#209 ·
All issues in precice/python-bindings
Similar issues
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100