don't crash when primitive values are thrown

This commit is contained in:
Evan Wallace 2013-01-18 00:17:51 -08:00
parent c50758519f
commit aafee108c4

View File

@ -102,6 +102,10 @@ Error.prepareStackTrace = function(error, stack) {
// Mimic node's stack trace printing when an exception escapes the process // Mimic node's stack trace printing when an exception escapes the process
process.on('uncaughtException', function(error) { process.on('uncaughtException', function(error) {
if (!error || !error.stack) {
console.log('Uncaught exception:', error);
process.exit();
}
var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack); var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
if (match) { if (match) {
var cache = {}; var cache = {};