From aafee108c44fa561eaca31e889f59eaba0ff0e71 Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Fri, 18 Jan 2013 00:17:51 -0800 Subject: [PATCH] don't crash when primitive values are thrown --- source-map-support.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source-map-support.js b/source-map-support.js index a8ff435..b0c22d9 100644 --- a/source-map-support.js +++ b/source-map-support.js @@ -102,6 +102,10 @@ Error.prepareStackTrace = function(error, stack) { // Mimic node's stack trace printing when an exception escapes the process 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); if (match) { var cache = {};