Browse Source

Merge pull request #43 from pbca26/master

added json parse error catch in shepherd get cache
all-modes
Satinder Grewal 8 years ago
committed by GitHub
parent
commit
b17452f4c3
  1. 10
      routes/shepherd.js

10
routes/shepherd.js

@ -117,9 +117,17 @@ shepherd.get('/cache', function(req, res, next) {
res.end(JSON.stringify(errorObj));
} else {
var parsedJSON = 'JSON parse error';
try {
parsedJSON = JSON.parse(data);
} catch (e) {
console.log('JSON parse error');
}
var successObj = {
'msg': 'success',
'result': data ? JSON.parse(data) : ''
'result': parsedJSON
};
res.end(JSON.stringify(successObj));

Loading…
Cancel
Save