aboutsummaryrefslogtreecommitdiff
path: root/node_modules/source-map-support/source-map-support.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-12-27 19:33:54 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-12-27 19:34:16 +0100
commit0e6de2c31dbf8c21277481f112e99c52b913940f (patch)
tree91789032de3b8eec9d789acd1323f25fc5d08422 /node_modules/source-map-support/source-map-support.js
parentceda0da31ad542c598c68146ae0712ca03df3d71 (diff)
node_modules
Diffstat (limited to 'node_modules/source-map-support/source-map-support.js')
-rw-r--r--node_modules/source-map-support/source-map-support.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/node_modules/source-map-support/source-map-support.js b/node_modules/source-map-support/source-map-support.js
index dca92bcbe..abd888604 100644
--- a/node_modules/source-map-support/source-map-support.js
+++ b/node_modules/source-map-support/source-map-support.js
@@ -80,7 +80,11 @@ retrieveFileHandlers.push(function(path) {
}
} else if (fs.existsSync(path)) {
// Otherwise, use the filesystem
- contents = fs.readFileSync(path, 'utf8');
+ try {
+ contents = fs.readFileSync(path, 'utf8');
+ } catch (er) {
+ contents = '';
+ }
}
return fileContentsCache[path] = contents;
@@ -331,8 +335,9 @@ function wrapCallSite(frame) {
// Fix position in Node where some (internal) code is prepended.
// See https://github.com/evanw/node-source-map-support/issues/36
- if (line === 1 && !isInBrowser() && !frame.isEval()) {
- column -= 62;
+ var headerLength = 62;
+ if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
+ column -= headerLength;
}
var position = mapSourcePosition({
@@ -387,7 +392,11 @@ function getErrorSource(error) {
// Support files on disk
if (!contents && fs && fs.existsSync(source)) {
- contents = fs.readFileSync(source, 'utf8');
+ try {
+ contents = fs.readFileSync(source, 'utf8');
+ } catch (er) {
+ contents = '';
+ }
}
// Format the line from the original source code like node does