mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-15 11:36:53 -04:00
Merge f4992fa40e
into 4592397bd9
This commit is contained in:
commit
f6eeb3ba1b
1 changed files with 27 additions and 22 deletions
|
@ -509,18 +509,15 @@ var padutils = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var globalExceptionHandler = undefined;
|
function globalExceptionHandler(msg, url, linenumber) {
|
||||||
function setupGlobalExceptionHandler() {
|
|
||||||
if (!globalExceptionHandler) {
|
|
||||||
globalExceptionHandler = function test (msg, url, linenumber)
|
|
||||||
{
|
|
||||||
var errorId = randomString(20);
|
var errorId = randomString(20);
|
||||||
if ($("#editorloadingbox").attr("display") != "none"){
|
if ($("#editorloadingbox").attr("display") != "none"){
|
||||||
//show javascript errors to the user
|
//show javascript errors to the user
|
||||||
$("#editorloadingbox").css("padding", "10px");
|
$("#editorloadingbox").css("padding", "10px");
|
||||||
$("#editorloadingbox").css("padding-top", "45px");
|
$("#editorloadingbox").css("padding-top", "45px");
|
||||||
$("#editorloadingbox").html("<div style='text-align:left;color:red;font-size:16px;'><b>An error occured</b><br>The error was reported with the following id: '" + errorId + "'<br><br><span style='color:black;font-weight:bold;font-size:16px'>Please send this error message to us: </span><div style='color:black;font-size:14px'>'"
|
// TODO: Use Mustache
|
||||||
+ "ErrorId: " + errorId + "<br>UserAgent: " + navigator.userAgent + "<br>" + msg + " in " + url + " at line " + linenumber + "'</div></div>");
|
$("#editorloadingbox").html("<div style='text-align:left;color:red;font-size:16px;'><b>An error occured</b><br>The error was reported with the following id: '" + Security.escapeHTML(errorId) + "'<br><br><span style='color:black;font-weight:bold;font-size:16px'>Please send this error message to us: </span><div style='color:black;font-size:14px'>'"
|
||||||
|
+ "ErrorId: " + Security.escapeHTML(errorId) + "<br>UserAgent: " + Security.escapeHTML(navigator.userAgent) + "<br>" + Security.escapeHTML(msg) + " in " + Security.escapeHTML(url) + " at line " + Security.escapeHTML(linenumber) + "'</div></div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
//send javascript errors to the server
|
//send javascript errors to the server
|
||||||
|
@ -531,8 +528,16 @@ function setupGlobalExceptionHandler() {
|
||||||
$.post(url, errObj);
|
$.post(url, errObj);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
var globalExceptionHandlerSetup = false;
|
||||||
|
function setupGlobalExceptionHandler() {
|
||||||
|
if (!globalExceptionHandlerSetup) {
|
||||||
|
globalExceptionHandlerSetup = true;
|
||||||
window.onerror = globalExceptionHandler;
|
window.onerror = globalExceptionHandler;
|
||||||
|
} else {
|
||||||
|
// no-op
|
||||||
|
// TODO: Throw an exception here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue