> besides, you shouldn't have to look at the string in the first place if you
> use JSON Parse with error handling.
Hmmm, this does seem to work in compiled mode:
C_OBJECT($ob)
C_TEXT($text)
ON ERR CALL("handler")
$text:="{\"OK\": True}" // The JSON is invalid because True should be written
as true.
$ob:=JSON Parse($text;Is object)
ON ERR CALL("")
But this tech tip doesn't work in compiled mode:
http://kb.4d.com/assetid=77555
However, it seems to be linked to this line in the utility method:
ON ERR CALL(Current method name)
If I replace that line and have it call a different method for the error
handler, it seems to work:
ON ERR CALL("handler")
So it seems that the problem here is that you cannot use the current method
name (neither the command nor the string value) to handle errors... I now
wonder if this line of code (ON ERR CALL(Current method name)) ever worked in
compiled mode - I thought I was being clever when I wrote it but maybe that is
the source of this issue.
I can update the tech tip to be more clear about this as it does appear to work
once that change is made.
-Tim
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************