Forward the backup trigger status code and error message

This commit is contained in:
Johannes Zellner
2015-09-28 14:19:31 +02:00
parent 5c51619798
commit f36946a8aa

View File

@@ -79,7 +79,7 @@ function backup(req, res, next) {
// !! below port has to be in sync with box/config.js internalPort
superagent.post('http://127.0.0.1:3001/api/v1/backup').end(function (error, result) {
if (error) return next(new HttpError(500, error));
if (result.statusCode !== 202) return next(new HttpError(500, 'trigger backup failed with ' + result.statusCode));
if (result.statusCode !== 202) return next(new HttpError(result.statusCode, 'trigger backup failed with ' + result.body.message));
next(new HttpSuccess(202, {}));
});
}