Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

only call callback if present

  • Loading branch information...
commit 999024a7a1508f404e6839a90218b510030f2abe 1 parent be65aa2
@zaach zaach authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 client/client.js
View
6 client/client.js
@@ -42,15 +42,15 @@ function request(args, cb) {
try {
data = JSON.parse(data);
} catch (e) {
- return cb('Invalid JSON response: ' + e);
+ return cb && cb('Invalid JSON response: ' + e);
}
}
data.session_context = {};
- cb(null, data);
+ if (cb) cb(null, data);
},
processData: false,
error: function(data, res, status) {
- cb('Error: ' + data + '\nStatus: ' + status);
+ if (cb) cb('Error: ' + data + '\nStatus: ' + status);
}
};
if (method == 'PUT' || method == 'POST') {
Please sign in to comment.
Something went wrong with that request. Please try again.