creator / scripts /ErrorException.js
K1Z3M1112's picture
Upload 8 files
913928f verified
Raw History Blame Contribute Delete
743 Bytes
/**
* 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;
}
}