[Pkg-javascript-commits] [node-jsonstream] 161/214: Revert "Revert "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 ab04db4e9d35bfe498b1c08d53fe37adee94e0c4
Author: Guillaume Chauvet <g.chauvet at bimedia.com.fr>
Date:   Mon Aug 3 10:09:46 2015 +0200

    Revert "Revert "Experimental fix for issue #66""
    
    This reverts commit 03c4ba58af289627d7ad247dc1cded2d4517f094.
---
 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