function foo(x) { if (!x) { console.warn('You must provide the x argument.'); } } function bar(x) { return { stack: [ { name: 'bar', fileName: 'Bar.js', lineNumber: 10, columnNumber: 5, } ], callback: foo.bind(null, x) }; } function invokeCallback(continuation) { console.stack(continuation.stack); continuation.callback(); console.endStack(); } var continuation = bar(false); invokeCallback(continuation); // Logs: // You must provide the x argument. // at foo (Example.js:3:4) // at bar (Bar.js:10:5)