aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--router.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/router.js b/router.js
index c498c0c..84c8ab1 100644
--- a/router.js
+++ b/router.js
@@ -19,14 +19,21 @@
}
}
};
- xhr.send();
+ try {
+ xhr.send();
+ } catch(err) {
+ errorHandler && errorHandler(err);
+ }
};
function router() {
var url = location.hash.slice(2) || 'presentation';
+ var contentElement = document.getElementById('content');
fetchFile('Pages/' + url + '.md', function(contentMd) {
- var contentElement = document.getElementById('content');
contentElement.innerHTML = markdown.toHTML(contentMd);
+ }, function() {
+ var notFoundPage = '<h1>Page non trouvée</h1><a href="#">Retour à l\'accueil</a>';
+ contentElement.innerHTML = notFoundPage;
});
}