Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yyzhuang opened this issue Aug 7, 2015 · 3 comments
Labels

Comments

@yyzhuang
Copy link

yyzhuang commented Aug 7, 2015

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, ...])

@aaaaalbert
Copy link
Contributor

My approach would be to make the security layer docs more verbose about this. (I think the error message is okay).

@JustinCappos
Copy link
Contributor

That makes sense to me.

On Mon, Aug 10, 2015 at 9:16 AM, aaaaalbert notifications@github.com
wrote:

My approach would be to make the security layer docs more verbose about
this. (I think the error message is okay).


Reply to this email directly or view it on GitHub
#173 (comment)
.

@aaaaalbert
Copy link
Contributor

Newcomers: Anyone who has taken Prof Cappos' security classes should be able to fix this in no time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants