My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 27: Better handle undefined variables
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jul 2009


 
Reported by fstr...@gmail.com, Jul 3, 2009
$console.log(jsontemplate.Template('vvv={vvv}').expand({xxx:10}))

Generate an exception difficult to intercept and on real/complex 
applications it is possibile that variables are not present in the json 
object.

I've made a patch that detects this situation, logs it and return an empty 
String to let the program execution continue without exceptions

I'll find it useful and think others too..

Thanks, Francesco.
json-template.diff
969 bytes   View   Download
Jul 3, 2009
Project Member #1 gtempacc...@yahoo.com
Thanks for the patch.  But you can use undefined_str in the latest version to make
the empty strings not throw undefined variable.  This is only in head -- I'll update
the pre-release files tomorrow.

Also, the null values throwing the exception is a bug that's not yet fixed: issue 21.
 So your instinct was right there.

Jul 9, 2009
Project Member #2 gtempacc...@yahoo.com
The release is now in the downloads area.  Let me know if this doesn't solve your
problem.

Status: Fixed

Powered by Google Project Hosting