update superagent

the latest superchanged changed the meaning of 'error'. Previously,
error implied a network error. With the latest superagent, error means
a REST api error i.e 4xx, 5xx are flagged as errors.

error && !error.response means network error
This commit is contained in:
Girish Ramakrishnan
2015-12-15 09:12:52 -08:00
parent aca443a909
commit a4ea693c3c
22 changed files with 369 additions and 528 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ function backupDone(filename, app, appBackupIds, callback) {
};
superagent.post(url).send(data).query({ token: config.token() }).end(function (error, result) {
if (error) return callback(error);
if (error && !error.response) return callback(error);
if (result.statusCode !== 200) return callback(new Error(result.text));
if (!result.body) return callback(new Error('Unexpected response'));