Skip to content

Commit

Permalink
fix emitting json syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Feb 16, 2018
1 parent 49c5649 commit 5d803b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Expand Up @@ -661,8 +661,10 @@ Browserify.prototype._json = function () {
// check json validity
JSON.parse(sanitizedString);
row.source = 'module.exports=' + sanitizedString;
} catch (e) {
this.emit('error', syntaxError(e.message, row.file || row.id));
} catch (err) {
err.message = 'While parsing ' + (row.file || row.id) + ': ' + err.message
this.emit('error', err);
return;
}
}
this.push(row);
Expand Down

0 comments on commit 5d803b8

Please sign in to comment.