diff options
-rw-r--r-- | modules/zelfoverhoor/docent.js | 14 |
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){ |