mirror of
https://github.com/calzoneman/sync.git
synced 2024-09-13 04:32:09 +00:00
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…
x
Reference in New Issue
Block a user