From ab68dcd283b06d615e2a11583feb57ed8a5d0dc4 Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Sun, 16 Oct 2016 00:14:50 +0200
Subject: [PATCH] added error handling to the moderator api in the frontend as
 requested in #138

---
 static/moderator.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/static/moderator.js b/static/moderator.js
index 6df530e..a229320 100644
--- a/static/moderator.js
+++ b/static/moderator.js
@@ -17,6 +17,7 @@ var moderator = {
 				dataType: "text",
 				contentType: "application/json",
 				data: JSON.stringify(dict),
+				error: moderator.api.handleapierror,
 				success: function () {
 					if (reload) {
 						window.location.reload();
@@ -32,6 +33,7 @@ var moderator = {
 				dataType: "text",
 				contentType: "application/json",
 				data: JSON.stringify(value),
+				error: moderator.api.handleapierror,
 				success: function () {
 					if (reload) {
 						window.location.reload();
@@ -39,6 +41,9 @@ var moderator = {
 				}
 			})
 		},
+		handleapierror: function(jqXHR, textStatus, errorThrow) {
+			alert("Fehler: "+errorThrow)	
+		},
 		gethttp: function (url){
 			$.ajax({
 				method: "GET",
-- 
GitLab