Improve errors from `convert` function
还没有人认领这个 Issue。
评估
调研方向
从 cyprecice/cyprecice.pyx 的 convert 函数(第 15-24 行)开始,在需要字符串的位置传入一个 Enum 成员,以重现该失败。更新错误行为,使其标识接收到的类型和受支持的类型,然后根据 issue 中的 Interface 示例验证生成的消息。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Cython
- 星标
- 30
- 派生
- 19
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
precice/python-bindings 的其他 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 68/100
precice/python-bindings#258 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 20/100
precice/python-bindings#255 ·
-
good first issue
难度 3/5 1-2 天 新手友好度 68/100
precice/python-bindings#248 ·
-
难度 3/5 1-2 天 新手友好度 38/100
precice/python-bindings#238 · 6 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
precice/python-bindings#209 ·
查看 precice/python-bindings 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
stratum-mining/stratum#2404 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
Diaoul/subliminal#1382 ·
-
fix(errors): EHOSTUNREACH from a happy-eyeballs connect is reported as a resolver error (STAMP-80) 未关闭
难度 2/5 1-3 小时 新手友好度 90/100
snapshot-labs/stamp#666 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
GauravKarakoti/SecureFlow#1070 · 1 条评论 ·
-
triage/confirmed
难度 2/5 1-3 小时 新手友好度 88/100
agentscope-ai/agentscope#2775 ·