[Pkg-javascript-commits] [node-jsonstream] 159/214: Experimental fix for issue #66

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 12:58:54 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-jsonstream.

commit 4143d645993b43f644d2c71bb9fafb57eb243dcb
Author: Guillaume Chauvet <g.chauvet at bimedia.com.fr>
Date:   Wed Jul 22 11:24:05 2015 +0200

    Experimental fix for issue #66
---
 index.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js
index 79e5efa..1c55492 100755
--- a/index.js
+++ b/index.js
@@ -18,7 +18,10 @@ exports.parse = function (path, map) {
   var stream = through(function (chunk) {
     if('string' === typeof chunk)
       chunk = new Buffer(chunk)
-    parser.write(chunk)
+    try {
+      parser.write(chunk);
+    } catch(e)  {
+    }
   },
   function (data) {
     if(data)
@@ -101,12 +104,16 @@ exports.parse = function (path, map) {
       }
     }
   }
-
+  
   parser.onError = function (err) {
     if(err.message.indexOf("at position") > -1)
       err.message = "Invalid JSON (" + err.message + ")";
     stream.emit('error', err)
   }
+  
+  parser.parseError = function(token, value) {
+      this.onError(new Error("Unexpected value " (value ? ("(" + JSON.stringify(value) + ")") : "")));
+  }
 
 
   return stream

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jsonstream.git



More information about the Pkg-javascript-commits mailing list