mirror of https://github.com/calzoneman/sync.git
Add try-catch to getJSON
This commit is contained in:
parent
f4c044c4be
commit
173ff8c2e5
|
@ -18,7 +18,12 @@ function getJSON(options, callback) {
|
|||
buffer += chunk;
|
||||
});
|
||||
res.on('end', function() {
|
||||
var data = JSON.parse(buffer);
|
||||
try {
|
||||
var data = JSON.parse(buffer);
|
||||
}
|
||||
catch(e) {
|
||||
console.log("JSON fail");
|
||||
}
|
||||
callback(res.statusCode, data);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue