twisted / nevow

Web Application Construction Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`undefined` should probably be handled in the same way as `null` by the JSON parser

jonathanj opened this issue · comments

In Javascript the natural return value of a function is undefined but the Nevow JSON parser does not understand undefined and often this comes up as an issue where a remote call chain ends without needing to specify a return value.

It's not terribly convenient to add return null everywhere to begin with but causing a server-side error, which is then sent to the client and subsequently disconnects them with a rather obscure traceback, is not terribly useful behaviour.

The JSON parser might as well treat undefined the same way as null.

For what it's worth, if a method that is called via callRemote returns undefined, this was already translated to null by the action_call machinery. However undefined can pop up in other cases as well.