Skip to content

Commit f049f69

Browse files
Remove try/catch throw to avoid swallowing JSON5 error output
Resolves webpack-contrib#33
1 parent 08be680 commit f049f69

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ import util from 'util';
77
import JSON5 from 'json5';
88

99
function Json5Loader(source) {
10-
let value;
11-
12-
try {
13-
value = JSON5.parse(source);
14-
} catch (e) {
15-
throw new Error('Error parsing JSON5', (e));
16-
}
10+
const value = JSON5.parse(source);
1711

1812
return `module.exports = ${util.inspect(value, { depth: null })}`;
1913
}

test/json5-loader.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe(PROJECT_NAME, () => {
1919
const brokenJson5 = '{broken: json5}';
2020
expect(() => {
2121
Json5Loader.call({}, brokenJson5);
22-
}).toThrow('Error parsing JSON5');
22+
}).toThrow(SyntaxError);
2323
done();
2424
});
2525

0 commit comments

Comments
 (0)