mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 23:44:54 +01:00
- Throw Error objects instead of Strings.
This commit is contained in:
parent
6555203a94
commit
cd776073dc
@ -15,7 +15,7 @@ $assert = function (assert, message) {
|
|||||||
if (!$defined(assert) || !assert) {
|
if (!$defined(assert) || !assert) {
|
||||||
var stack;
|
var stack;
|
||||||
try {
|
try {
|
||||||
null.eval();
|
throw Error("Unexpected Exception");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
stack = e;
|
stack = e;
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ function stackTrace(exception) {
|
|||||||
|
|
||||||
if (!$defined(exception)) {
|
if (!$defined(exception)) {
|
||||||
try {
|
try {
|
||||||
throw "Dummy Exception"
|
throw Error("Unexpected Exception");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception = e;
|
exception = e;
|
||||||
}
|
}
|
||||||
@ -45,6 +45,8 @@ function stackTrace(exception) {
|
|||||||
else if (window.opera && exception.message) { //Opera
|
else if (window.opera && exception.message) { //Opera
|
||||||
result = exception.message;
|
result = exception.message;
|
||||||
} else { //IE and Safari
|
} else { //IE and Safari
|
||||||
|
result = exception.sourceURL + ': ' + exception.line + "\n\n";
|
||||||
|
|
||||||
var currentFunction = arguments.callee.caller;
|
var currentFunction = arguments.callee.caller;
|
||||||
while (currentFunction) {
|
while (currentFunction) {
|
||||||
var fn = currentFunction.toString();
|
var fn = currentFunction.toString();
|
||||||
|
@ -80,7 +80,7 @@ mindplot.IconGroup = new Class({
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
throw "Icon can no be found.";
|
throw new Error("Icon can no be found:" + iconModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -47,7 +47,7 @@ mindplot.LocalStorageManager = new Class({
|
|||||||
|
|
||||||
// If I could not load it from a file, hard code one.
|
// If I could not load it from a file, hard code one.
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
throw "Map could not be loaded";
|
throw new Error("Map could not be loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ web2d.Element = new Class({
|
|||||||
initialize : function(peer, attributes) {
|
initialize : function(peer, attributes) {
|
||||||
this._peer = peer;
|
this._peer = peer;
|
||||||
if (peer == null) {
|
if (peer == null) {
|
||||||
throw "Element peer can not be null";
|
throw new Error("Element peer can not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($defined(attributes)) {
|
if ($defined(attributes)) {
|
||||||
@ -53,7 +53,7 @@ web2d.Element = new Class({
|
|||||||
for (var key in batchExecute) {
|
for (var key in batchExecute) {
|
||||||
var func = this[key];
|
var func = this[key];
|
||||||
if (!$defined(func)) {
|
if (!$defined(func)) {
|
||||||
throw "Could not find function: " + key;
|
throw new Error("Could not find function: " + key);
|
||||||
}
|
}
|
||||||
func.apply(this, batchExecute[key]);
|
func.apply(this, batchExecute[key]);
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ web2d.Element = new Class({
|
|||||||
* Returns element type name.
|
* Returns element type name.
|
||||||
*/
|
*/
|
||||||
getType : function() {
|
getType : function() {
|
||||||
throw "Not implemeneted yet. This method must be implemented by all the inherited objects.";
|
throw new Error("Not implemeneted yet. This method must be implemented by all the inherited objects.");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +146,7 @@ web2d.Element = new Class({
|
|||||||
*/
|
*/
|
||||||
setStroke : function(width, style, color, opacity) {
|
setStroke : function(width, style, color, opacity) {
|
||||||
if (style != null && style != undefined && style != 'dash' && style != 'dot' && style != 'solid' && style != 'longdash' && style != "dashdot") {
|
if (style != null && style != undefined && style != 'dash' && style != 'dot' && style != 'solid' && style != 'longdash' && style != "dashdot") {
|
||||||
throw "Unsupported stroke style: '" + style + "'";
|
throw new Error("Unsupported stroke style: '" + style + "'");
|
||||||
}
|
}
|
||||||
this._peer.setStroke(width, style, color, opacity);
|
this._peer.setStroke(width, style, color, opacity);
|
||||||
},
|
},
|
||||||
|
@ -46,7 +46,7 @@ function buildDesigner(options) {
|
|||||||
emulation:false,
|
emulation:false,
|
||||||
urlEncoded:false
|
urlEncoded:false
|
||||||
}).post(JSON.encode({
|
}).post(JSON.encode({
|
||||||
jsErrorMsg:"message: " + message + ", line:" + lineNo + ", :" + url,
|
jsErrorMsg:"message: '" + message + "', line:'" + lineNo + "', :" + url,
|
||||||
jsStack:window.errorStack,
|
jsStack:window.errorStack,
|
||||||
userAgent:navigator.userAgent,
|
userAgent:navigator.userAgent,
|
||||||
mapId:options.mapId}));
|
mapId:options.mapId}));
|
||||||
|
Loading…
Reference in New Issue
Block a user