Commit bd811459 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

GuiMessageError removed in favor of ValidationError

parent 0663d184
minerva (12.2.0~beta.2) unstable; urgency=medium minerva (12.2.0~beta.2) unstable; urgency=medium
* Bug fix: selecting too few parameters in export doesn't throw reportable
error (#721)
* Bug fix: changes in selected checkbox in add project dialog block UI (#722) * Bug fix: changes in selected checkbox in add project dialog block UI (#722)
* Bug fix: providing invalid overlay id in url could break minerva (#726) * Bug fix: providing invalid overlay id in url could break minerva (#726)
* Bug fix: Editing project with images and submaps could cause a problem * Bug fix: Editing project with images and submaps could cause a problem
......
...@@ -7,7 +7,6 @@ var logger = require('./logger'); ...@@ -7,7 +7,6 @@ var logger = require('./logger');
var Functions = require('./Functions'); var Functions = require('./Functions');
var SecurityError = require('./SecurityError'); var SecurityError = require('./SecurityError');
var ValidationError = require('./ValidationError'); var ValidationError = require('./ValidationError');
var GuiMessageError = require('./gui/GuiMessageError');
/** /**
* This static global object contains set of functions that returns/set data in * This static global object contains set of functions that returns/set data in
......
"use strict";
/* exported logger */
var logger = require('../logger');
/**
*
* @param {string} message
* @constructor
* @extends {Error}
*/
function GuiMessageError(message) {
this.message = message;
this.stack = (new Error(message)).stack;
}
GuiMessageError.prototype = Object.create(Error.prototype);
GuiMessageError.prototype.constructor = GuiMessageError;
module.exports = GuiMessageError;
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/* exported logger */ /* exported logger */
var AbstractExportPanel = require('./AbstractExportPanel'); var AbstractExportPanel = require('./AbstractExportPanel');
var GuiMessageError = require('../GuiMessageError'); var ValidationError = require('../../ValidationError');
var IdentifiedElement = require('../../map/data/IdentifiedElement'); var IdentifiedElement = require('../../map/data/IdentifiedElement');
// noinspection JSUnusedLocalSymbols // noinspection JSUnusedLocalSymbols
...@@ -71,7 +71,7 @@ ElementExportPanel.prototype.createResponseString = function () { ...@@ -71,7 +71,7 @@ ElementExportPanel.prototype.createResponseString = function () {
var elements = []; var elements = [];
return self.getSelectedTypes().then(function (result) { return self.getSelectedTypes().then(function (result) {
if (result.length === 0) { if (result.length === 0) {
return Promise.reject(new GuiMessageError("You must select at least one type")); return Promise.reject(new ValidationError("You must select at least one type"));
} }
types = result; types = result;
return self.getSelectedIncludedCompartments(); return self.getSelectedIncludedCompartments();
...@@ -108,7 +108,7 @@ ElementExportPanel.prototype.createResponseString = function () { ...@@ -108,7 +108,7 @@ ElementExportPanel.prototype.createResponseString = function () {
return self.getSelectedColumns(); return self.getSelectedColumns();
}).then(function (selectedColumns) { }).then(function (selectedColumns) {
if (selectedColumns.length === 0) { if (selectedColumns.length === 0) {
return Promise.reject(new GuiMessageError("You must select at least one column")); return Promise.reject(new ValidationError("You must select at least one column"));
} }
var rowPromises = []; var rowPromises = [];
......
...@@ -8,7 +8,7 @@ var Promise = require("bluebird"); ...@@ -8,7 +8,7 @@ var Promise = require("bluebird");
// noinspection JSUnusedLocalSymbols // noinspection JSUnusedLocalSymbols
var logger = require('../../logger'); var logger = require('../../logger');
var Functions = require('../../Functions'); var Functions = require('../../Functions');
var GuiMessageError = require('../GuiMessageError'); var ValidationError = require('../../ValidationError');
var Alias = require('../../map/data/Alias'); var Alias = require('../../map/data/Alias');
/** /**
...@@ -167,13 +167,13 @@ NetworkExportPanel.prototype.createResponseString = function () { ...@@ -167,13 +167,13 @@ NetworkExportPanel.prototype.createResponseString = function () {
var reactionTypesDiv = $("[name='reactionTypes']", self.getElement())[0]; var reactionTypesDiv = $("[name='reactionTypes']", self.getElement())[0];
return self.getSelectedTypes(elementTypesDiv).then(function (result) { return self.getSelectedTypes(elementTypesDiv).then(function (result) {
if (result.length === 0) { if (result.length === 0) {
return Promise.reject(new GuiMessageError("You must select at least one element type")); return Promise.reject(new ValidationError("You must select at least one element type"));
} }
elementTypes = result; elementTypes = result;
return self.getSelectedTypes(reactionTypesDiv); return self.getSelectedTypes(reactionTypesDiv);
}).then(function (result) { }).then(function (result) {
if (result.length === 0) { if (result.length === 0) {
return Promise.reject(new GuiMessageError("You must select at least one reaction type")); return Promise.reject(new ValidationError("You must select at least one reaction type"));
} }
reactionTypes = result; reactionTypes = result;
return self.getSelectedIncludedCompartments(); return self.getSelectedIncludedCompartments();
...@@ -221,7 +221,7 @@ NetworkExportPanel.prototype.createResponseString = function () { ...@@ -221,7 +221,7 @@ NetworkExportPanel.prototype.createResponseString = function () {
return self.getSelectedColumns(); return self.getSelectedColumns();
}).then(function (selectedColumns) { }).then(function (selectedColumns) {
if (selectedColumns.length === 0) { if (selectedColumns.length === 0) {
return Promise.reject(new GuiMessageError("You must select at least one column")); return Promise.reject(new ValidationError("You must select at least one column"));
} }
var rowPromises = []; var rowPromises = [];
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require("../../mocha-config.js"); require("../../mocha-config.js");
var ElementExportPanel = require('../../../../main/js/gui/export/ElementExportPanel'); var ElementExportPanel = require('../../../../main/js/gui/export/ElementExportPanel');
var GuiMessageError = require('../../../../main/js/gui/GuiMessageError'); var ValidationError = require('../../../../main/js/ValidationError');
var MiriamType = require('../../../../main/js/map/data/MiriamType'); var MiriamType = require('../../../../main/js/map/data/MiriamType');
var ServerConnector = require('../../ServerConnector-mock'); var ServerConnector = require('../../ServerConnector-mock');
var logger = require('../../logger'); var logger = require('../../logger');
...@@ -197,7 +197,7 @@ describe('ElementExportPanel', function () { ...@@ -197,7 +197,7 @@ describe('ElementExportPanel', function () {
}).then(function () { }).then(function () {
return exportObject.createResponseString(); return exportObject.createResponseString();
}).then(null, function (error) { }).then(null, function (error) {
assert.ok(error instanceof GuiMessageError); assert.ok(error instanceof ValidationError);
}); });
}); });
}); });
......
Supports Markdown
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