Skip to content

Commit 241ea1a

Browse files
committed
emitWarning is expecting an Error object
1 parent c1dc68f commit 241ea1a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

index.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,28 @@ module.exports = function(input, inputMap) {
4343
try {
4444
map = JSON.parse(mapStr)
4545
} catch (e) {
46-
emitWarning("Cannot parse inline SourceMap '" + mapBase64.substr(0, 50) + "': " + e);
46+
emitWarning(new Error("Cannot parse inline SourceMap '"
47+
+ mapBase64.substr(0, 50) + "': " + e));
4748
return untouched();
4849
}
4950
processMap(map, this.context, callback);
5051
} else {
5152
resolveAbsolutePath(this.context, url, function(err, absoluteFilepath) {
5253
if(err) {
53-
emitWarning("Cannot find SourceMap '" + url + "': " + err);
54+
emitWarning(new Error("Cannot find SourceMap '" + url + "': " + err));
5455
return untouched();
5556
}
5657
fs.readFile(absoluteFilepath, "utf-8", function(err, content) {
5758
if(err) {
58-
emitWarning("Cannot open SourceMap '" + absoluteFilepath + "': " + err);
59+
emitWarning(new Error("Cannot open SourceMap '" + absoluteFilepath + "': " + err));
5960
return untouched();
6061
}
6162
addDependency(absoluteFilepath);
6263
var map;
6364
try {
6465
map = JSON.parse(content);
6566
} catch (e) {
66-
emitWarning("Cannot parse SourceMap '" + url + "': " + e);
67+
emitWarning(new Error("Cannot parse SourceMap '" + url + "': " + e));
6768
return untouched();
6869
}
6970
processMap(map, path.dirname(absoluteFilepath), callback);
@@ -101,7 +102,7 @@ module.exports = function(input, inputMap) {
101102
const sourcesPromises = sources.map((source, sourceIndex) => new Promise((resolveSource) => {
102103
resolveAbsolutePath(context, source, function(err, absoluteFilepath) {
103104
if(err) {
104-
emitWarning("Cannot find source file '" + source + "': " + err);
105+
emitWarning(new Error("Cannot find source file '" + source + "': " + err));
105106
return resolveSource({
106107
source: source,
107108
content: sourcesContent[sourceIndex] != null ? sourcesContent[sourceIndex] : null
@@ -115,7 +116,7 @@ module.exports = function(input, inputMap) {
115116
}
116117
fs.readFile(absoluteFilepath, "utf-8", function(err, content) {
117118
if(err) {
118-
emitWarning("Cannot open source file '" + absoluteFilepath + "': " + err);
119+
emitWarning(new Error("Cannot open source file '" + absoluteFilepath + "': " + err));
119120
return resolveSource({
120121
source: absoluteFilepath,
121122
content: null

0 commit comments

Comments
 (0)