File size: 743 Bytes
913928f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * Author: Peter Dragicevic [peter@petschko.org]
 * Authors-Website: http://petschko.org/
 * Date: 04.04.2017
 * Time: 20:23
 */

/**
 * Creates a new ErrorException
 *
 * @param {string} message - Exception-Message
 * @param {int|undefined|null} code - Exception-Error-Code
 * @constructor - ErrorException
 */
function ErrorException(message, code) {
	if(code === undefined || code === null || isNaN(code))
		code = 0;

	this.name = 'ErrorException';
	this.message = message;
	this.code = code;

	/**
	 * Returns the Exception as String
	 *
	 * @returns {string} - Exception as String
	 */
	this.toString = function() {
		return this.name + ': (' + html(lang.strings['exception.errorCode']) + ' ' + this.code + ') ' + this.message;
	}
}