longjohn
次のコードを使用すると、間違ったスタック トレースが取得されます。setTimeout
から呼び出されていることが示されてfirstfunction
いますが、実際には最初の関数が実行される前にプログラムがクラッシュしています。
ここでチケットを作成しました https://github.com/mattinsler/longjohn/issues/16
var longjohn = require("longjohn");
setTimeout(function () {
throw new Error();
}, 10);
setTimeout(function () {
firstfunction();
}, 10000);
var firstfunction = function () {
setTimeout(function () {
console.log("First function");
}, 10);
}
スタックトレース
/home/jeevan/node_js/node_modules/longjohn/dist/longjohn.js:181
throw e;
^
Error
at firstfunction (/home/jeevan/node_js/longjohn.js:11:11)
at listOnTimeout (timers.js:110:15)
---------------------------------------------
at Object.<anonymous> (/home/jeevan/node_js/longjohn.js:10:1)
at Module._compile (module.js:456:26)
at Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Module._load (module.js:312:12)
at Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
私の質問は、何が問題になるのか、それを修正する方法です。