aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/schedule.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2016-12-15 14:13:43 +0100
committerNoah Loomans <noahloomans@gmail.com>2016-12-15 14:13:43 +0100
commitb6542a78c14b3d2e350b6620272a88094abda1c1 (patch)
treeb4e33cdb51970ea0dbc6068cc33b28aaa0c3172d /public/javascripts/schedule.js
parent13ceee415eb81a4d72f63df013eca2a442865d81 (diff)
add user frendly error handling
Diffstat (limited to 'public/javascripts/schedule.js')
-rw-r--r--public/javascripts/schedule.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js
index e3944f8..72171c6 100644
--- a/public/javascripts/schedule.js
+++ b/public/javascripts/schedule.js
@@ -1,5 +1,4 @@
const leftPad = require('left-pad')
-const autocomplete = require('./autocomplete')
const search = require('./search')
const self = {}
@@ -23,11 +22,19 @@ self._handleLoad = function (event) {
}
const document = self._parseMeetingpointHTML(request.response)
self._nodes.schedule.appendChild(document)
+ self._nodes.schedule.classList.remove('error')
}
self._handleError = function (event) {
const request = event.target
- console.error(request)
+ let error
+ if (request.status === 404) {
+ error = 'Sorry, er is (nog) geen rooster voor deze week.'
+ } else {
+ error = 'Sorry, er is iets mis gegaan tijdens het laden van deze week.'
+ }
+ self._nodes.schedule.textContent = error
+ self._nodes.schedule.classList.add('error')
}
self._getURLOfUsers = function (week, type, index) {