fix callback in sent
This commit is contained in:
parent
342b9bd937
commit
7f20106d71
6 changed files with 27 additions and 18 deletions
|
|
@ -100,15 +100,9 @@ Insight.prototype._request = function(options, callback) {
|
|||
if (request.readyState === 4) {
|
||||
console.log('[Insight.js.102]', request); //TODO
|
||||
if (request.status === 200) {
|
||||
try {
|
||||
return callback(null, JSON.parse(request.responseText));
|
||||
} catch (e) {
|
||||
|
||||
console.log('[Insight.js.106]'); //TODO
|
||||
return callback({message: 'Wrong response from insight'});
|
||||
}
|
||||
} else {
|
||||
|
||||
return callback(null, JSON.parse(request.responseText));
|
||||
}
|
||||
else {
|
||||
console.log('[Insight.js.111]'); //TODO
|
||||
return callback({message: 'Error ' + request.status});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue