diff options
-rw-r--r-- | router.js | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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; }); } |