You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Jesse MacFadyen (JIRA)" <ji...@apache.org> on 2012/09/07 02:58:08 UTC

[jira] [Resolved] (CB-1364) Errors not logged currently - use window.onerror in templates/cordova.js to expose them

     [ https://issues.apache.org/jira/browse/CB-1364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse MacFadyen resolved CB-1364.
---------------------------------

    Resolution: Fixed

{code:javascript}
var oldOnError = window.onerror;
window.onerror = function(msg,fileName,line) {
    oldOnError && oldOnError(msg,fileName,line);
    debugConsole.error(msg + " file:" + fileName + " Line:" + line);
};
{code}

This is now handled in console.js and part of the framework.
                
> Errors not logged currently - use window.onerror in templates/cordova.js to expose them
> ---------------------------------------------------------------------------------------
>
>                 Key: CB-1364
>                 URL: https://issues.apache.org/jira/browse/CB-1364
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: WP7
>    Affects Versions: 2.0.0
>         Environment: Visual studio 2010 Express for Windows Phone, WP7 emulator
>            Reporter: Ville M. Vainio
>            Assignee: Jesse MacFadyen
>             Fix For: 2.1.0
>
>
> Currently, you don't get any information on javascript errors (trying to access undefined attributes, etc).
> At least on WP7 version of the phonegap, window.onerror works and gives you useful information. I ran this and started to get my errors logged properly:
>         window.onerror = function() {
>          console.log ("Error: " + JSON.stringify(arguments));         
>         }
> Something like this should come out of the box, either in cordova.js or in the quickstart template. It's not obvious to most developers that something like window.onerror is even available, since most are used to getting this information in web inspector / firebug console.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Re: [jira] [Resolved] (CB-1364) Errors not logged currently - use window.onerror in templates/cordova.js to expose them

Posted by Jesse <pu...@gmail.com>.
Gord,
Using addEventListener catches the error, but does not expose the
message, fileName or lineNumber.

On Thu, Sep 6, 2012 at 5:58 PM, Jesse MacFadyen (JIRA) <ji...@apache.org> wrote:
>
>      [ https://issues.apache.org/jira/browse/CB-1364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Jesse MacFadyen resolved CB-1364.
> ---------------------------------
>
>     Resolution: Fixed
>
> {code:javascript}
> var oldOnError = window.onerror;
> window.onerror = function(msg,fileName,line) {
>     oldOnError && oldOnError(msg,fileName,line);
>     debugConsole.error(msg + " file:" + fileName + " Line:" + line);
> };
> {code}
>
> This is now handled in console.js and part of the framework.
>
>> Errors not logged currently - use window.onerror in templates/cordova.js to expose them
>> ---------------------------------------------------------------------------------------
>>
>>                 Key: CB-1364
>>                 URL: https://issues.apache.org/jira/browse/CB-1364
>>             Project: Apache Cordova
>>          Issue Type: Improvement
>>          Components: WP7
>>    Affects Versions: 2.0.0
>>         Environment: Visual studio 2010 Express for Windows Phone, WP7 emulator
>>            Reporter: Ville M. Vainio
>>            Assignee: Jesse MacFadyen
>>             Fix For: 2.1.0
>>
>>
>> Currently, you don't get any information on javascript errors (trying to access undefined attributes, etc).
>> At least on WP7 version of the phonegap, window.onerror works and gives you useful information. I ran this and started to get my errors logged properly:
>>         window.onerror = function() {
>>          console.log ("Error: " + JSON.stringify(arguments));
>>         }
>> Something like this should come out of the box, either in cordova.js or in the quickstart template. It's not obvious to most developers that something like window.onerror is even available, since most are used to getting this information in web inspector / firebug console.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira



-- 
@purplecabbage
risingj.com