Skip to content

Commit 2e7c0dc

Browse files
authored
Merge pull request #9 from pipelinedb/add-try-catch-for-large-data
Add try catch for large data
2 parents 0edbedf + 876f492 commit 2e7c0dc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipelinedb/stride",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "Stride.io JavaScript API client",
55
"main": "index.js",
66
"scripts": {

src/stride.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ function SubscribeObjectTransform() {
115115
let objects = chunk.toString('utf8').trim().split('\r\n')
116116
for (let obj of objects) {
117117
if (obj = obj.trim()) {
118-
obj = JSON.parse(obj)
118+
try {
119+
obj = JSON.parse(obj)
120+
} catch(e) {
121+
return console.error(e)
122+
}
119123
if (obj && typeof obj === 'object') this.push(obj)
120124
}
121125
}

0 commit comments

Comments
 (0)