Commit 6dce94b4 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

validation errors are catched and passed to gui

parent f6893d7d
......@@ -38,6 +38,7 @@ var SbmlParameter = require('./map/data/SbmlParameter');
var SecurityError = require('./SecurityError');
var SessionData = require('./SessionData');
var User = require('./map/data/User');
var ValidationError = require('./ValidationError');
var PrivilegeType = require('./map/data/PrivilegeType');
var GuiConnector = require('./GuiConnector');
......@@ -2433,7 +2434,14 @@ ServerConnector.addGeneMapping = function (params) {
name: params.mappingName,
url: params.mappingUrl
};
return self.sendPostRequest(self.getReferenceGenomeGeneMappingsUrl(params), data);
return self.sendPostRequest(self.getReferenceGenomeGeneMappingsUrl(params), data).catch(function (e) {
if (e instanceof NetworkError && e.statusCode === HttpStatus.BAD_REQUEST) {
var content = JSON.parse(e.content);
throw new ValidationError(content.reason);
} else {
return self.processNetworkError(e);
}
});
};
/**
*
......
......@@ -621,7 +621,7 @@ EditGenomeDialog.prototype.openAddGeneMapping = function () {
return self.refresh();
}).then(function () {
$(dialog).dialog('destroy').remove();
});
}).catch(GuiConnector.alert);
},
'Cancel': function () {
$(this).dialog('destroy').remove();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment