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.
The error return by the
convertfunction is not helpful at the moment. I stumbled over this when I organized my participant names in anEnumOne has to pass, for example,
ParticipantNames.MASS_LEFT.valueto the API. But I forgot the.valuespart, which led to an errors similar toI 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.