1
をキャッチしながらも:のNode.jsクラッシュし、私はあなたがキャッチされない例外をキャッチし、ここにいくつかのサンプルコードだ場合でも、型エラーにNode.jsのクラッシュを気づいたキャッチされない例外
var http = require('http');
process.on('uncaughtException', function (err) {
console.log(err.stack);
});
var test = [];
// This causes the error because test[0] is undefined
console.log(test[0].toLowerCase());
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
はキャッチする方法はありますエラーを表示し、node.jsを実行し続ける。
更新:この場合、uncaughtExceptionハンドラが起動していますが、それ以降もクラッシュします。
それはむしろ恥ずかしかった:) –