summaryrefslogtreecommitdiff
path: root/modules/zelfoverhoor
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2018-04-18 20:51:06 +0200
committerTom Smeding <tom.smeding@gmail.com>2018-04-18 20:51:06 +0200
commitc28df227a09cc083a266ba15defe545d8173ad15 (patch)
tree78d4893add27b4c72b3b18f2ec7ec7f5b2c41342 /modules/zelfoverhoor
parenta00c93ac174b4c9b01ddd020f8a6d4a32e18f5b2 (diff)
Make error-sending code slightly more robust?
Diffstat (limited to 'modules/zelfoverhoor')
-rw-r--r--modules/zelfoverhoor/docent.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/zelfoverhoor/docent.js b/modules/zelfoverhoor/docent.js
index b44d4b6..1c738b2 100644
--- a/modules/zelfoverhoor/docent.js
+++ b/modules/zelfoverhoor/docent.js
@@ -1,8 +1,14 @@
window.addEventListener("error",function(err){
- var str=err.filename+":"+err.lineno+" "+err.error+": "+err.message;
- var xhr=new XMLHttpRequest();
- xhr.open("POST","/zelfoverhoor/error");
- xhr.send(str);
+ try {
+ var str="("+err+") "+err.filename+":"+err.lineno+" "+err.error+": "+err.message;
+ var xhr=new XMLHttpRequest();
+ xhr.responseType="text";
+ xhr.open("POST","/zelfoverhoor/error");
+ xhr.setRequestHeader("Content-Type", "text/plain");
+ xhr.send(str);
+ } catch(e){
+ console.log("Error sending error:", e);
+ }
});
window.onbeforeunload=function(ev){