Merge pull request #41 from joeyespo/remove-leading-newline

Remove leading newline in getErrorSource
This commit is contained in:
Julien Fontanet 2015-05-23 20:23:08 +02:00
commit 577ca52a5b

View File

@ -335,7 +335,7 @@ function getErrorSource(error) {
if (contents) { if (contents) {
var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1]; var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
if (code) { if (code) {
return '\n' + source + ':' + line + '\n' + code + '\n' + return source + ':' + line + '\n' + code + '\n' +
new Array(column).join(' ') + '^'; new Array(column).join(' ') + '^';
} }
} }
@ -349,7 +349,10 @@ function handleUncaughtExceptions(error) {
console.error('Uncaught exception:', error); console.error('Uncaught exception:', error);
} else { } else {
var source = getErrorSource(error); var source = getErrorSource(error);
if (source !== null) console.error(source); if (source !== null) {
console.error();
console.error(source);
}
console.error(error.stack); console.error(error.stack);
} }
process.exit(1); process.exit(1);