Report with a distinguished status code if upstream validation failed

This commit is contained in:
Johannes Zellner
2016-10-11 11:49:30 +02:00
parent 9b4228f373
commit e614b930a5

View File

@@ -183,6 +183,7 @@ function setBackupConfig(req, res, next) {
settings.setBackupConfig(req.body, function (error) {
if (error && error.reason === SettingsError.BAD_FIELD) return next(new HttpError(400, error.message));
if (error && error.reason === SettingsError.EXTERNAL_ERROR) return next(new HttpError(402, error.message));
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(200));