javascript: getting the name of the calling function
<p>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:</p>

<pre><code>function A() {

  //lots of works to calculate SomeParameters; can bug
  CalledVeryOften(SomeParameters);
}

function CalledVeryOften(SomeParameters) {
  // a little bit of work
}
</code></pre>

<p>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.</p>

<p>Is there a way in CalledVeryOften to determine which function it was called from?</p>

<p>Thanks.</p>
