I'm writing an error event handler that captures an error and make an ajax call to the server to report it. The problem is that a lot of times, my code looks like this:
function A() {
  //lots of works to calculate SomeParameters; can bug
  CalledVeryOften(SomeParameters);
}
function CalledVeryOften(SomeParameters) {
  // a little bit of work
}
If I capture the event in function A (or B, C, D...), great! But the problem is that if the window.onerror event fires in CalledVeryOften then it might be that the parameters might not be properly calculated.
Is there a way in CalledVeryOften to determine which function it was called from?
Thanks.
