Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/gchauvet/JSONStream
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictarr committed Sep 17, 2015
2 parents b3cb1fd + ba91d72 commit 2125fa6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ exports.parse = function (path, map) {
}
}
}

parser.onError = function (err) {
if(err.message.indexOf("at position") > -1)
err.message = "Invalid JSON (" + err.message + ")";
Expand Down
20 changes: 20 additions & 0 deletions test/issues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var JSONStream = require('../');
var test = require('tape')

test('#66', function (t) {
var error = 0;
var stream = JSONStream
.parse()
.on('error', function (err) {
t.ok(err);
error++;
})
.on('end', function () {
t.ok(error === 1);
t.end();
});

stream.write('["foo":bar[');
stream.end();

});

0 comments on commit 2125fa6

Please sign in to comment.