Results 1 to 6 of 6

Thread: Obtaining call stack programatically

  1. #1
    Ext JS Premium Member
    Join Date
    Jan 2012
    Posts
    14
    Vote Rating
    0
      0  

    Default 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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Answers
    3976
    Vote Rating
    1367
      0  

    Default

    You can use a try/catch block
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2012
    Posts
    14
    Vote Rating
    0
      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,791
    Answers
    584
    Vote Rating
    392
      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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Answers
    3976
    Vote Rating
    1367
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #6
    Ext JS Premium Member
    Join Date
    Jan 2012
    Posts
    14
    Vote Rating
    0
      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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •