Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0b3eb56d

Přidáno uživatelem Pavel Fidranský před více než 6 roky(ů)

renamed InvalidArgumentException class to InvalidExceptionError to comply with JS conventions

Zobrazit rozdíly:

sources/src/main/webapp/js/errors/invalidArgumentError.js
1
/**
2
 * Error thrown when an argument of the function call is not valid.
3
 */
4
class InvalidArgumentError extends Error {
5
}
sources/src/main/webapp/js/exceptions/invalidArgumentException.js
1
/**
2
 * Exception thrown when an argument of the function call is not valid.
3
 * @constructor
4
 * @param {string} message Message of the exception.
5
 */
6
function InvalidArgumentException(message) {
7
	/** @prop {string} message */
8
	this.message = message;
9
}
sources/src/main/webapp/js/graphLoader.js
6 6
	/**
7 7
	 * Loads a new graph using graph data passed as parameters.
8 8
	 * @param {object} data Data of the graph.
9
	 * @throws {InvalidArgumentException} Thrown when either graph data are incomplete.
9
	 * @throws {InvalidArgumentError} Thrown when either graph data are incomplete.
10 10
	 */
11 11
	this.run  = function(data) {
12 12
		if (app.utils.isUndefined(data.vertices) || app.utils.isUndefined(data.edges)) {
13
			throw new InvalidArgumentException('Invalid data.');
13
			throw new InvalidArgumentError('Invalid data.');
14 14
		}
15 15

  
16 16
		var canvasSize = ((data.vertices.length * 75) / Math.round(Math.sqrt(data.vertices.length))) + 1000;
sources/src/main/webapp/js/utils/dom.js
26 26
	 * @param {string} tagName Type of the newly created element (div, span, ...).
27 27
	 * @param {object} attributes Attributes of the element.
28 28
	 * @returns {Element} HTML DOM element.
29
	 * @throws {InvalidArgumentException} Thrown when tagName is not a valid HTML tag.
29
	 * @throws {InvalidArgumentError} Thrown when tagName is not a valid HTML tag.
30 30
	 */
31 31
	this.createHtmlElement = function(tagName, attributes) {
32 32
		if (htmlTags.indexOf(tagName) === -1) {
33
			throw new InvalidArgumentException(tagName, 'is not a valid HTML element');
33
			throw new InvalidArgumentError(tagName + 'is not a valid HTML element');
34 34
		}
35 35

  
36 36
		var element = document.createElement(tagName);
......
47 47
	 * @param {string} tagName Type of the element (circle, rect, ...).
48 48
	 * @param {object} attributes Attributes of the element.
49 49
	 * @returns {Element} SVG DOM element.
50
	 * @throws {InvalidArgumentException} Thrown when tagName is not a valid SVG tag.
50
	 * @throws {InvalidArgumentError} Thrown when tagName is not a valid SVG tag.
51 51
	 */
52 52
	this.createSvgElement = function(tagName, attributes) {
53 53
		if (svgTags.indexOf(tagName) === -1) {
54
			throw new InvalidArgumentException(tagName, 'is not a valid SVG element');
54
			throw new InvalidArgumentError(tagName + 'is not a valid SVG element');
55 55
		}
56 56

  
57 57
		var element = document.createElementNS('http://www.w3.org/2000/svg', tagName);
sources/src/main/webapp/showGraph.jsp
39 39
		<script src="js/components/vertexSymbolList.js"></script>
40 40
		<script src="js/components/viewport.js"></script>
41 41

  
42
		<script src="js/exceptions/invalidArgumentException.js"></script>
42
		<script src="js/errors/invalidArgumentError.js"></script>
43 43

  
44 44
		<script src="js/constants.js"></script>
45 45
		<script src="js/coordinates.js"></script>

Také k dispozici: Unified diff