You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Patrick Mueller (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/03/29 15:02:25 UTC

[jira] [Issue Comment Edited] (CB-387) try/catch wrapper in native iOS code for cordova-js initialization firing alerts when page without cordova.js is loaded in

    [ https://issues.apache.org/jira/browse/CB-387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13241196#comment-13241196 ] 

Patrick Mueller edited comment on CB-387 at 3/29/12 1:02 PM:
-------------------------------------------------------------

After thinking about this for 5 more seconds, there's a chicken-and-egg problem with expecting a {{cordova}} global (got the case right this time) to be available, when it's not available :-)

Doesn't mean a consistent logging story used throughout Cordova isn't a bad thing, and I'll open a separate JIRA feature request on that.  

It also doesn't mean we can take advantage of that, somehow, in this case.  For instance, it's possible we could design some kind of 'logger' module which could be used as a plain old module with {{require()}} (and/or attached to {{cordova}}) *AND* allow it to be literally included in some other {{eval()}}'y context like {{stringByEvaluatingJavaScriptFromString}}.

Something to noodle over.  I'm keen to provide *AS MUCH* diagnostic information as we can, and "fail fast" is probably a nice aspect to take into account, for fatal conditions like this.  This can significantly cut down on the # of support requests we get for initial-error conditions.
                
      was (Author: pmuellr):
    After thinking about this for 5 more seconds, there's a chicken-and-egg problem with expecting a {{cordova}} global (got the case right this time) to be available, when it's not available :-)

Doesn't mean a consistent logging story used throughout Cordova isn't a bad thing, and I'll open a separate JIRA feature request on that.  

It also doesn't mean we can take advantage of that, somehow, in this case.  For instance, it's possible we could design some kind of 'logger' module which could be used as a plain old module with {{require()}} (and/or attached to {{cordova}}) *AND*

                  
> 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: https://issues.apache.org/jira/browse/CB-387
>             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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira