Commit a0a78541 authored by Sven Franck's avatar Sven Franck

fixed error messages of renderJs.mapUrl

parent 2c2efaf7
...@@ -1029,24 +1029,24 @@ ...@@ -1029,24 +1029,24 @@
}); });
}; };
// => "global" errorHandler
priv.errorHandler = function (message, internal) {
return (internal === true) ? undefined : message +" specified", "405", {};
};
// ================ public API (call on renderJs and $(elem) =========== // ================ public API (call on renderJs and $(elem) ===========
// => public API to map a URL via Ajax and run the result through a callback // => public API to map a URL via Ajax and run the result through a callback
that.mapUrl = function (url, callback, internal) { that.mapUrl = function (url, callback, internal) {
var queryString = typeof url === "string" ? url : url.search; var queryString = typeof url === "string" ? url : url.search;
if (queryString) { if (queryString) {
priv.mapUrlInternal(queryString).done( priv.mapUrlInternal(queryString)
callback ? callback : priv.errorHandler("no callback", internal) .done(callback ? callback : ("no callback specified", "405", {}));
);
} else { } else {
// we still need to run a callback, if only internally? // we still need to run a callback if specified
internal ? (callback ? callback() : priv.errorHandler("no callback")) : if (callback) {
priv.errorHandler("no query parameter") callback(internal ? undefined :
{"error": "no querystring specified"}, "405", {}
);
} else {
return "no callback specified", "405", {};
}
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment