1. #1
    Ext JS Premium Member
    Join Date
    Jan 2012
    Posts
    14
    Vote Rating
    0
    baardos is on a distinguished road

      0  

    Default Unanswered: Obtaining call stack programatically

    Unanswered: Obtaining call stack programatically


    Hi All,

    I am trying to detect a tricky and hard to reproduce issue in my code and I need to obtain call stack programmatically. Is there anything is ext-js-4 that could help in doing that?

    Regards,
    Bartek

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,047
    Answers
    3493
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can use a try/catch block
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2012
    Posts
    14
    Vote Rating
    0
    baardos is on a distinguished road

      0  

    Default


    Hmmm - there is no exception involved - it is more about seeing from where certain methods are invoked and why. So if they get called and hist certain condition I would like to see the full call stack in an alert or logs.

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,592
    Answers
    541
    Vote Rating
    323
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    If you just want to kick off the debugger you can add a breakpoint or use the debugger statement in your code. Most browsers support conditional breakpoints so that they only pause execution if some condition is met.

    However, to answer your question directly:

    Code:
    var stack = new Error().stack

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,047
    Answers
    3493
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can google for 'javascript stack trace' and you will find quite a few pages on different ways to do it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Ext JS Premium Member
    Join Date
    Jan 2012
    Posts
    14
    Vote Rating
    0
    baardos is on a distinguished road

      0  

    Default


    Since I need to capture a stacktrace when the issue happens and there is a very little chance to do so when debugger is on I used the following library: https://github.com/eriwen/javascript-stacktrace

Thread Participants: 2

Tags for this Thread