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
* 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: providing invalid overlay id in url could break minerva (#726)
* Bug fix: Editing project with images and submaps could cause a problem
......
......@@ -7,7 +7,6 @@ var logger = require('./logger');
var Functions = require('./Functions');
var SecurityError = require('./SecurityError');
var ValidationError = require('./ValidationError');
var GuiMessageError = require('./gui/GuiMessageError');
/**
* 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 @@
/* exported logger */
var AbstractExportPanel = require('./AbstractExportPanel');
var GuiMessageError = require('../GuiMessageError');
var ValidationError = require('../../ValidationError');
var IdentifiedElement = require('../../map/data/IdentifiedElement');
// noinspection JSUnusedLocalSymbols
......@@ -71,7 +71,7 @@ ElementExportPanel.prototype.createResponseString = function () {
var elements = [];
return self.getSelectedTypes().then(function (result) {
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;
return self.getSelectedIncludedCompartments();
......@@ -108,7 +108,7 @@ ElementExportPanel.prototype.createResponseString = function () {
return self.getSelectedColumns();
}).then(function (selectedColumns) {
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 = [];
......
......@@ -8,7 +8,7 @@ var Promise = require("bluebird");
// noinspection JSUnusedLocalSymbols
var logger = require('../../logger');
var Functions = require('../../Functions');
var GuiMessageError = require('../GuiMessageError');
var ValidationError = require('../../ValidationError');
var Alias = require('../../map/data/Alias');
/**
......@@ -167,13 +167,13 @@ NetworkExportPanel.prototype.createResponseString = function () {
var reactionTypesDiv = $("[name='reactionTypes']", self.getElement())[0];
return self.getSelectedTypes(elementTypesDiv).then(function (result) {
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;
return self.getSelectedTypes(reactionTypesDiv);
}).then(function (result) {
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;
return self.getSelectedIncludedCompartments();
......@@ -221,7 +221,7 @@ NetworkExportPanel.prototype.createResponseString = function () {
return self.getSelectedColumns();
}).then(function (selectedColumns) {
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 = [];
......
......@@ -3,7 +3,7 @@
require("../../mocha-config.js");
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 ServerConnector = require('../../ServerConnector-mock');
var logger = require('../../logger');
......@@ -197,7 +197,7 @@ describe('ElementExportPanel', function () {
}).then(function () {
return exportObject.createResponseString();
}).then(null, function (error) {
assert.ok(error instanceof GuiMessageError);
assert.ok(error instanceof ValidationError);
});
});
});
......
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