- Improve error login message.

This commit is contained in:
Paulo Gustavo Veiga 2012-09-23 10:39:56 -03:00
parent 85d41300bf
commit 9c632faf77

View File

@ -32,17 +32,23 @@ function buildDesigner(options) {
}); });
window.onerror = function (message, url, lineNo) { window.onerror = function (message, url, lineNo) {
if(message==="Script error." && lineNo==0){
// Log error message ... // Ignore errors ...
if (message === "Script error." && lineNo == 0) {
// http://stackoverflow.com/questions/5913978/cryptic-script-error-reported-in-javascript-in-chrome-and-firefox // http://stackoverflow.com/questions/5913978/cryptic-script-error-reported-in-javascript-in-chrome-and-firefox
return; return;
} }
// Trasform error ...
if (window.waitDialog) { var errorMsg = message;
window.waitDialog.close.delay(1000, window.waitDialog); if (typeof(message) === 'object' && message.srcElement && message.target) {
window.waitDialog = null; if (message.srcElement == '[object HTMLScriptElement]' && message.target == '[object HTMLScriptElement]') {
errorMsg = 'Error loading script';
} else {
errorMsg = 'Event Error - target:' + message.target + ' srcElement:' + message.srcElement;
}
} }
errorMsg = errorMsg.toString();
new Request({ new Request({
method:'post', method:'post',
@ -51,11 +57,18 @@ 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: '" + errorMsg + "', line:'" + lineNo + "', :" + url,
jsStack:window.errorStack, jsStack:window.errorStack,
userAgent:navigator.userAgent, userAgent:navigator.userAgent,
mapId:options.mapId})); mapId:options.mapId}));
// Close loading dialog ...
if (window.waitDialog) {
window.waitDialog.close.delay(1000, window.waitDialog);
window.waitDialog = null;
}
// Open error dialog only in case of mindmap loading errors. The rest of the error are reported but not display the dialog. // Open error dialog only in case of mindmap loading errors. The rest of the error are reported but not display the dialog.
// Remove this in the near future. // Remove this in the near future.
if (!window.mindmapLoadReady) { if (!window.mindmapLoadReady) {