From 8898e9b8c5038d435b1b806d2f41386a29676231 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sun, 19 Jan 2014 21:43:10 -0300 Subject: [PATCH] add error messages to sync status --- app/controllers/status.js | 3 +-- lib/HistoricSync.js | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/status.js b/app/controllers/status.js index 01b51b9..6652359 100644 --- a/app/controllers/status.js +++ b/app/controllers/status.js @@ -45,8 +45,7 @@ exports.show = function(req, res, next) { } }; -exports.sync = function(req, res, next) { +exports.sync = function(req, res) { if (req.syncInfo) res.jsonp(req.syncInfo); - next(); }; diff --git a/lib/HistoricSync.js b/lib/HistoricSync.js index 2735f44..f9d3d0a 100644 --- a/lib/HistoricSync.js +++ b/lib/HistoricSync.js @@ -274,11 +274,13 @@ function spec() { }); } - if (!err) - sync(); - else { + if (err) { + self.syncInfo = util._extend(self.syncInfo, { error: err.message }); return next(err, 0); } + else { + sync(); + } }); };