mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +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) {
|
||||
var stack;
|
||||
try {
|
||||
null.eval();
|
||||
throw Error("Unexpected Exception");
|
||||
} catch (e) {
|
||||
stack = e;
|
||||
}
|
||||
@ -33,7 +33,7 @@ function stackTrace(exception) {
|
||||
|
||||
if (!$defined(exception)) {
|
||||
try {
|
||||
throw "Dummy Exception"
|
||||
throw Error("Unexpected Exception");
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
@ -45,6 +45,8 @@ function stackTrace(exception) {
|
||||
else if (window.opera && exception.message) { //Opera
|
||||
result = exception.message;
|
||||
} else { //IE and Safari
|
||||
result = exception.sourceURL + ': ' + exception.line + "\n\n";
|
||||
|
||||
var currentFunction = arguments.callee.caller;
|
||||
while (currentFunction) {
|
||||
var fn = currentFunction.toString();
|
||||
|
@ -80,7 +80,7 @@ mindplot.IconGroup = new Class({
|
||||
}, this);
|
||||
|
||||
if (result == null) {
|
||||
throw "Icon can no be found.";
|
||||
throw new Error("Icon can no be found:" + iconModel);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -47,7 +47,7 @@ mindplot.LocalStorageManager = new Class({
|
||||
|
||||
// If I could not load it from a file, hard code one.
|
||||
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) {
|
||||
this._peer = peer;
|
||||
if (peer == null) {
|
||||
throw "Element peer can not be null";
|
||||
throw new Error("Element peer can not be null");
|
||||
}
|
||||
|
||||
if ($defined(attributes)) {
|
||||
@ -53,7 +53,7 @@ web2d.Element = new Class({
|
||||
for (var key in batchExecute) {
|
||||
var func = this[key];
|
||||
if (!$defined(func)) {
|
||||
throw "Could not find function: " + key;
|
||||
throw new Error("Could not find function: " + key);
|
||||
}
|
||||
func.apply(this, batchExecute[key]);
|
||||
}
|
||||
@ -114,7 +114,7 @@ web2d.Element = new Class({
|
||||
* Returns element type name.
|
||||
*/
|
||||
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) {
|
||||
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);
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ function buildDesigner(options) {
|
||||
emulation:false,
|
||||
urlEncoded:false
|
||||
}).post(JSON.encode({
|
||||
jsErrorMsg:"message: " + message + ", line:" + lineNo + ", :" + url,
|
||||
jsErrorMsg:"message: '" + message + "', line:'" + lineNo + "', :" + url,
|
||||
jsStack:window.errorStack,
|
||||
userAgent:navigator.userAgent,
|
||||
mapId:options.mapId}));
|
||||
|
Loading…
Reference in New Issue
Block a user