Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
Commit error (raise split exception) |
Tue, Oct 8 2013 8:58 AM | Permanent Link |
lejetou | Here is a simple code :
Database.StartTransaction; DS.Insert; DS.Columns['mycol'].AsString:=getColContent; DS.Save; Database.Commit getColContent is a function. This function call of an external JS function. if unfortunatly this external function returns value : undefined commit raise an exeception : Uncaught TypeError: Cannot call method 'split' of undefined after a quick look in JS of my app, i've found that "webcore_escapestr" raise this exeception because it is called with undefined parameter (this call is in webdata_tdatavalue.$p.getjson = function() => webcore_escapestr($t.getasstring())) I'll test the returned value of my function, but as the error message is very confusing, I think it will be better to fix that in the framework. I think getasstring() should return "" if value is undefined Best regards |
Tue, Oct 8 2013 11:31 AM | Permanent Link |
Matthew Jones | > I think getasstring() should return "" if value is undefined
It would presumably be even better if it didn't let you set it thus. /Matthew Jones/ |
Tue, Oct 8 2013 3:44 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << getColContent is a function. This function call of an external JS function. >> EWB cannot compile/validate external code past the external interface, so it is the responsibility of the external code to not return invalid data to the EWB application. If I were to start introducing type-checking into the framework, it would defeat the whole purpose of having a compiler at all, and we'd all be back to using JavaScript just like everyone else where every single parameter, etc. has to be type-checked for correctness in a defensive manner. Tim Young Elevate Software www.elevatesoft.com |
Tue, Oct 8 2013 3:45 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Matthew,
<< It would presumably be even better if it didn't let you set it thus. >> Please see my prior response - doing this would be heading down the road to making the EWB compiler irrelevant. This is one of the reasons why EWB is designed to be strict about requiring an external interface for external JS. Tim Young Elevate Software www.elevatesoft.com |
Wed, Oct 9 2013 4:03 AM | Permanent Link |
Matthew Jones | Okay, so it would thus be better, for such things, to have a "SanityCheck()"
routine that did something like function SanityCheck(StringValue : String); begin Result := StringValue; if Result = undefined then // not sure on syntax for this raise Error.Create('invalid data'); end; I forget how to do the check for undefined and exception stuff outside EWB, but they've been posted here before. The code would thus become: DS.Columns['mycol'].AsString:=SanityCheck(getColContent); /Matthew Jones/ |
This web page was last updated on Friday, September 13, 2024 at 03:42 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |