summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-03-05 10:50:15 +0300
committerAndrew Dolgov <[email protected]>2017-03-05 10:50:15 +0300
commit270c0a00e5d9c8ce8a120bd48575d36c7ceaca0e (patch)
treed435a0d53d0da3dd7a0553cf4d99d45ccc40c7aa /js
parente0a957b3f66f1fb35060e51c63f0a271d9a7d938 (diff)
improve JS error logging with additional stuff
Diffstat (limited to 'js')
-rwxr-xr-xjs/functions.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/js/functions.js b/js/functions.js
index ddb27cba1..b33c23dc1 100755
--- a/js/functions.js
+++ b/js/functions.js
@@ -32,31 +32,32 @@ Array.prototype.remove = function(s) {
function report_error(message, filename, lineno, colno, error) {
- exception_error(error);
+ exception_error(error, null, filename, lineno);
}
-function exception_error(e, e_compat) {
+function exception_error(e, e_compat, filename, lineno, colno) {
if (typeof e == "string") e = e_compat;
if (!e) return; // no exception object, nothing to report.
try {
+ console.error(e);
+ var msg = e.toString();
try {
new Ajax.Request("backend.php", {
- parameters: {op: "rpc", method: "log", logmsg: msg},
+ parameters: {op: "rpc", method: "log",
+ file: e.fileName ? e.fileName : filename,
+ line: e.lineNumber ? e.lineNumber : lineno,
+ msg: msg, context: e.stack},
onComplete: function (transport) {
- console.log(transport.responseText);
+ console.warn(transport.responseText);
} });
} catch (e) {
console.error("Exception while trying to log the error.", e);
}
- var msg = e.toString();
-
- console.error(msg);
-
var content = "<div class='fatalError'><p>" + msg + "</p>";
if (e.stack) {