Skip to content

wrapper.r2py needs better error messages for function's argument type checking #173

Description

@yyzhuang

I defined a function in Sensibility's sensor layer like so:

CHILD_CONTEXT_DEF["tts_speak"] = {
"type": "func",
"args": str,
"return": None,
"exceptions": "any",
"target": getsensor.tts_speak, }

This function should be called like this: tts_speak("hello"), where "hello" is the single argument. When I rant the code, I got this error:

12.8230729103 Fatal Error: Function 'tts_speak' does not specify argument definition as tuple or list!

This error comes from wrapper.r2py https://github.com/SeattleTestbed/seattlelib_v2/blob/master/wrapper.r2py#L427 This effectively does not allow functions to have a single argument, as argument types should be defined as "args": (type1, type2, type3, ...). Even "args": (type1) does not work: it should be "args": (type1,).

A clearer message should say something like Function 'tts_speak' should specify argument definition as tuple or list, such as "args": (type1, [type2, type3, ...])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions