cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Mueller (Commented) (JIRA)" <>
Subject [jira] [Commented] (CB-387) try/catch wrapper in native iOS code for cordova-js initialization firing alerts when page without cordova.js is loaded in
Date Thu, 29 Mar 2012 12:40:25 GMT


Patrick Mueller commented on CB-387:

Technically speaking, the message might more appropriately be "Error: executing module function
'setInfo' in module 'cordova/plugin/ios/device'".  I think we should actually print that.

Of course, we can infer a lot more about what's going on, based on the context.  "cordova-js
not available" captures the spirit of that contextual problem, but ... is not terribly helpful.
 Perhaps a hint "Have you included the iOS version of the cordova-x.y.z.js file?"  Presumably
the native code can plugin the version part of the string.  This would actually be a good
place to validate the version, and platform (can we sniff it?) and throw specific messages

Lastly, if they don't have cordova loaded, then is console.log() even going to work?  For
iOS, what are our built-in, requires-no-natives options on notifying the user.  alert() doesn't
work here either, right?  We could replace the body of their DOM with an error message, for

This is just one instance of being able to report problems back to users - we should actually
have some functions available like {{log()}} and {{fatalError()}} (the names I typically now
use for apps), that will log errors in a consistent place, and log an error then kill itself,
respectively.  The error we've caught here would be a candidate for calling {{fatalError()}}.

These functions should be rooted off Cordova.  I'd suggest adding these TO Cordova, until
Cordova gets too busy and then moving it to a {{logger}} property, or something.
> try/catch wrapper in native iOS code for cordova-js initialization firing alerts when
page without cordova.js is loaded in
> --------------------------------------------------------------------------------------------------------------------------
>                 Key: CB-387
>                 URL:
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.6.0
>         Environment: 1.6.0rc1 <--- FYI!!
>            Reporter: Filip Maj
>            Assignee: Shazron Abdullah
>            Priority: Blocker
>             Fix For: 1.6.0
> Originally authored by code I wrote! My bad!
> See line 370 of CDVViewController.m: 
> {code}
> NSMutableString *result = [[NSMutableString alloc] initWithFormat:@"try{require('cordova/plugin/ios/device').setInfo(%@);}catch(e){alert('errorz1!!!');alert(JSON.stringify(e))}",
[deviceProperties JSONString]];
> {code}
> We should have a graceful way of degrading this, perhaps run a console.log instead? Suggestions?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message