You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by nikhilkh <gi...@git.apache.org> on 2015/07/14 20:24:41 UTC

[GitHub] cordova-js pull request: CB-9366 Log error.stack as it helps with ...

GitHub user nikhilkh opened a pull request:

    https://github.com/apache/cordova-js/pull/118

    CB-9366 Log error.stack as it helps with diagnosing the source of the…

    … error

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-js errorStack

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-js/pull/118.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #118
    
----
commit 174ff92ae52493711e59d144949cc1f62bcb2cad
Author: Nikhil Khandelwal <ni...@microsoft.com>
Date:   2015-07-14T18:18:02Z

    CB-9366 Log error.stack as it helps with diagnosing the source of the error

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9366 Log error.stack as it helps with ...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-js/pull/118#issuecomment-121752375
  
    If you have multiple calls to cordova methods and one of them might be missing a callback or passing another incorrect argument (like in a scenario similar to the recent `new Media()` bug) a call stack tells you in your code the line which might have resulting in that exception causing your app to crash. The bug fixed in https://github.com/apache/cordova-plugin-media/commit/5f8738c5267be70562df9714e6f3971790b37d19 would have been much easier to identify from buildBot [ADB logs](https://ci.apache.org/builders/cordova-android-win/builds/31/steps/gathering-logs/logs/stdio) if we had a stack. Instead, I had to get into the debugger to identify the issue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9366 Log error.stack as it helps with ...

Posted by jimmont <gi...@git.apache.org>.
Github user jimmont commented on the pull request:

    https://github.com/apache/cordova-js/pull/118#issuecomment-179440047
  
    [This try-catch](https://github.com/apache/cordova-js/blob/master/src/cordova.js#L228) for callbacks is a real pain. Having access to errors as they occur is highly desirable. And there appears to be [a logic error here](https://github.com/apache/cordova-js/blob/master/src/cordova.js#L223) where callbacks are never deleted if they throw an error. Isn't managing errors a responsibility outside of `self.cordova`? Just started looking at this javascript after a *lot* of problematic worker debugging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9366 Log error.stack as it helps with ...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-js/pull/118#issuecomment-121640154
  
    What's the downside of adding this? This is really an exceptional scenario and should not hit commonly to clutter console log with ugly stack traces. Also, rethrowing the error will reset it's stack property - depending on which runtime and platform you are using and hence. window.onerror might not get the actual stack that caused the error.
    Putting it in console.log makes sure it shows in ADB logcat, Windows debug logs - hence, it makes it easier for people to root cause such issues.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9366 Log error.stack as it helps with ...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-js/pull/118#issuecomment-121336324
  
    I would leave this to userland.
    ```window.onerror = function(err,filename,lineNumber) {
      ...
    }```
    
    Also, on iOS this is going to look like :
    callMe@file:///Users/purplecabbage/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F40363A6-5AFE-4E19-8125-A1A4C928595D/HelloCordova.app/www/js/index.js:12:13
    iAmFunky@file:///Users/purplecabbage/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F40363A6-5AFE-4E19-8125-A1A4C928595D/HelloCordova.app/www/js/index.js:26:33
    fire@file:///Users/purplecabbage/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F40363A6-5AFE-4E19-8125-A1A4C928595D/HelloCordova.app/www/cordova.js:750:28
    file:///Users/purplecabbage/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F40363A6-5AFE-4E19-8125-A1A4C928595D/HelloCordova.app/www/cordova.js:223:53


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9366 Log error.stack as it helps with ...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-js/pull/118#issuecomment-121736314
  
    Not a huge deal. I was assuming that most errors here would be the result of a missing callback, in which case stack.length is 0.
    In the case where the user has an error in their success/error handler this might help them, but I am still not sure how much more value they would get than window.onerror


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9366 Log error.stack as it helps with ...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-js/pull/118#issuecomment-180637928
  
    @jimmont Why is the `try-catch` a pain? Is it because the stack gets reset here? You have a fair point about the callback not being deleted on exception scenarios.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9366 Log error.stack as it helps with ...

Posted by jimmont <gi...@git.apache.org>.
Github user jimmont commented on the pull request:

    https://github.com/apache/cordova-js/pull/118#issuecomment-181090801
  
    @nikhilkh Yes. Throwing errors is a reliable way of both debugging and finding problems. When they're intercepted I can't do that as easily. (Similar is true of `cordova-plugin-console`.) In looking through the source cordova uses a module loader and http requests to setup **global** APIs from the **local filesystems** on the device, and various events/event-system to get the sequence and setup right. Seems sub-optimal to me. (For example, a concatenated script which works with the global namespace directly seems like the simple approach, all things considered, and is what happens in the end anyway.) But I haven't finished looking at all the contemporary platforms (that I want to target anyhow). No one asked for these observations but given I'm seeing them, and how expensive time-wise it is to work either with or around them, thought I'd mention it. (In case more context is helpful: imagine debugging getting cordova and all the desired plugins working in a worker so the UI is mor
 e responsive. By all appearances the original authors didn't plan for this scenario.)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org