Custom Exception handling added master
Custom Exception handling added
Util now contains Exception base class and NotImplementedException
Measurment class now throws NotImplementedExceptions for pure virtual
methods

--- a/source/lib/scripts/CabinetEditor/Schematic/Other/Measurements/Measurement.js
+++ b/source/lib/scripts/CabinetEditor/Schematic/Other/Measurements/Measurement.js
@@ -10,6 +10,8 @@
 
 	 	'Geometry/Point2D',
 	 	'Geometry/LineSegment2D',
+
+	 	'Util/Exception/NotImplementedException',
 
 	 	'Util/UI',
 	 	'Util/UMath',
@@ -27,6 +29,8 @@
 		Point,
 		LineSegment,
 
+		NotImplementedException,
+
 		UI,
 		UMath,
 		Class
@@ -90,19 +94,19 @@
 		};
 
 		Measurement.prototype.getLine = function(){
-			throw "Measurment.getLine virtual function call";
+			throw new NotImplementedException("Measurment.getLine virtual function call");
 		};
 
 		Measurement.prototype.getCenter = function(){
-			throw "Measurment.getCenter virtual function call";
+			throw  new NotImplementedException("Measurment.getCenter virtual function call");
 		};
 
 		Measurement.prototype.getAngle = function(){
-			throw "Measurment.getRotation virtual function call";
+			throw  new NotImplementedException("Measurment.getRotation virtual function call");
 		};
 
 		Measurement.prototype.removeReferences = function(){
-			throw "Measurment.removeReferences virtual function call";
+			throw  new NotImplementedException("Measurment.removeReferences virtual function call");
 		};
 
 		Measurement.prototype.getContextMenu = function(windowPoint, schematicPoint, editor){

--- a/source/lib/scripts/CabinetEditor/Schematic/Other/Measurements/ObjMeasurement.js
+++ b/source/lib/scripts/CabinetEditor/Schematic/Other/Measurements/ObjMeasurement.js
@@ -4,6 +4,7 @@
 
 	 	'Geometry/Point2D',
 
+	 	'Util/Exception/Exception',
 	 	'Util/Class'
 	],
 	function(
@@ -11,6 +12,7 @@
 
 		Point,
 
+		Exception,
 		Class
 	){
 
@@ -82,12 +84,12 @@
 					return line;
 
 				} else {
-					throw "Cardinal side " + this.objectSide + " does not exist for object with ID " + this.objectID;
+					throw new Exception("Cardinal side " + this.objectSide + " does not exist for object with ID " + this.objectID);
 				}
 
 			}
 
-			throw "Object Reference is null can't generate measurment ID " + this.id + " points";
+			throw new Exception("Object Reference is null can't generate measurment ID " + this.id + " points");
 
 		};
 

--- a/source/lib/scripts/Util/Class.js
+++ b/source/lib/scripts/Util/Class.js
@@ -1,5 +1,10 @@
 define(
-	function(){
+	[
+	 	'Util/Exception/Exception'
+	],
+	function(
+		Exception
+	){
 
 		var Class = {};
 
@@ -18,7 +23,7 @@
 			var name = clas.prototype.className();
 
 			if(Class.registrationList[name] !== undefined)
-				throw "Class already registered!";
+				throw  new Exception("Class already registered!");
 
 			Class.registrationList[name] = clas;
 
@@ -29,7 +34,7 @@
 			var clas = Class.registrationList[name];
 
 			if(clas === undefined)
-				throw "Class \'" + name + "\' not registered!";
+				throw new Exception("Class \'" + name + "\' not registered!");
 
 			return clas;
 

--- /dev/null
+++ b/source/lib/scripts/Util/Exception/Exception.js
@@ -1,1 +1,25 @@
+define(
+	function(){
 
+		var Exception = function(message){
+
+			this.message = message;
+
+		};
+
+		Exception.prototype.className = function(){
+
+			return 'Exception';
+
+		}
+
+		Exception.prototype.toString = function(){
+
+			return this.className() + ": " + this.message;
+
+		}
+
+		return Exception;
+
+	}
+);

--- /dev/null
+++ b/source/lib/scripts/Util/Exception/NotImplementedException.js
@@ -1,1 +1,26 @@
+define(
+	[
+	 	'Util/Exception/Exception',
+	 	'Util/Class'
+	],
+	function(
+		Exception,
+		Class
+	){
 
+	var NotImplementedException = function(message){
+
+		Exception.call(this, message);
+
+	};
+
+	Class.extend(Exception, NotImplementedException);
+
+	NotImplementedException.prototype.className = function(){
+		return 'NotImplementedException';
+	};
+
+	return NotImplementedException;
+
+});
+

--- a/source/lib/scripts/Util/NumberPool.js
+++ b/source/lib/scripts/Util/NumberPool.js
@@ -1,5 +1,10 @@
 define(
-	function(){
+	[
+	 	'Util/Exception/Exception'
+	],
+	function(
+		Exception
+	){
 
 		var NumberPool = function(initialSize, maxSize){
 
@@ -25,7 +30,7 @@
 				return this.currentMax - 1;
 			}
 
-			else throw "NumberPool is at maximum size " + this.maxSize;
+			else throw new Exception("NumberPool is at maximum size " + this.maxSize);
 
 		};
 
@@ -33,12 +38,12 @@
 
 			for(var i = 0; i < this.available.length; i++){
 				if(this.available[i] === number){
-					throw "Number " + number + " already in pool";
+					throw new Exception("Number " + number + " already in pool");
 				}
 			}
 
 			if(number >= this.currentMax){
-				throw "Number " + number + " was not released from pool";
+				throw new Exception("Number " + number + " was not released from pool");
 			}
 
 			this.available.push(number);
@@ -59,7 +64,7 @@
 				}
 			}
 
-			throw "Number " + number + " not available in pool";
+			throw new Exception("Number " + number + " not available in pool");
 
 		};