function first(){ doSomething(); } // Lots of code function doSomething(){ alert('Somehow, I know that' + doSomething + 'function called me...'); alert('Boink, hit an error, but now you know what function called me'); }