summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-11-25 16:33:41 +0100
committertomsmeding <tom.smeding@gmail.com>2017-11-25 16:33:41 +0100
commit2193edfa40ef4e53342126ec1badc10338ae35b6 (patch)
treeec3e3ec402d8d08e9ee759d954a65d187216e914
parentccbf092d56b8ddf4ab27a67558af047e447d0f7d (diff)
zelfoverhoor: Add js error reporting
-rw-r--r--modules/zelfoverhoor/docent.js7
-rw-r--r--modules/zelfoverhoor/qs.js7
-rw-r--r--modules/zelfoverhoor/zelfoverhoor.js8
3 files changed, 22 insertions, 0 deletions
diff --git a/modules/zelfoverhoor/docent.js b/modules/zelfoverhoor/docent.js
index 456ea2f..2aef2e8 100644
--- a/modules/zelfoverhoor/docent.js
+++ b/modules/zelfoverhoor/docent.js
@@ -1,3 +1,10 @@
+window.addEventListener("error",function(err){
+ console.log(JSON.stringify(err));
+ var xhr=new XMLHttpRequest();
+ xhr.open("POST","/zelfoverhoor/error");
+ xhr.send(JSON.stringify(err));
+});
+
var questionsets=null;
var currentlyEditing=null;
diff --git a/modules/zelfoverhoor/qs.js b/modules/zelfoverhoor/qs.js
index 43d68f0..c07f8be 100644
--- a/modules/zelfoverhoor/qs.js
+++ b/modules/zelfoverhoor/qs.js
@@ -1,3 +1,10 @@
+window.addEventListener("error",function(err){
+ console.log(JSON.stringify(err));
+ var xhr=new XMLHttpRequest();
+ xhr.open("POST","/zelfoverhoor/error");
+ xhr.send(JSON.stringify(err));
+});
+
var setname=questionset.name;
var setdescription=questionset.description;
var questions=questionset.questions;
diff --git a/modules/zelfoverhoor/zelfoverhoor.js b/modules/zelfoverhoor/zelfoverhoor.js
index 8f87f75..d1d3068 100644
--- a/modules/zelfoverhoor/zelfoverhoor.js
+++ b/modules/zelfoverhoor/zelfoverhoor.js
@@ -220,6 +220,14 @@ module.exports=function(app,io,_moddir){
res.send();
});
+ app.post("/zelfoverhoor/error",function(req,res){
+ if(typeof req.body=="string"){
+ fs.appendFile(moddir+"/errors.txt",req.body,function(err){
+ if(err)console.log(err);
+ });
+ }
+ });
+
app.get("/zelfoverhoor/docent/docent.js",function(req,res){
res.sendFile(moddir+"/docent.js");
});