From abd679888af5dd32ecc2896ff4dddd3eed85f3d7 Mon Sep 17 00:00:00 2001 From: rr- Date: Sat, 11 Jun 2016 09:30:22 +0200 Subject: [PATCH] client/general: make fatal errors fatal --- client/js/api.js | 2 +- client/js/util/views.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/client/js/api.js b/client/js/api.js index de9221f..24537de 100644 --- a/client/js/api.js +++ b/client/js/api.js @@ -97,7 +97,7 @@ class Api { } } if (minViableRank === null) { - console.error('Bad privilege name: ' + lookup); + throw `Bad privilege name: ${lookup}`; } let myRank = this.user !== null ? this.allRanks.indexOf(this.user.rank) : diff --git a/client/js/util/views.js b/client/js/util/views.js index e5e3033..69f15dc 100644 --- a/client/js/util/views.js +++ b/client/js/util/views.js @@ -249,8 +249,7 @@ function htmlToDom(html) { function getTemplate(templatePath) { if (!(templatePath in templates)) { - console.error('Missing template: ' + templatePath); - return null; + throw `Missing template: ${templatePath}`; } const templateFactory = templates[templatePath]; return ctx => { @@ -319,8 +318,8 @@ function showView(target, source) { } } else if (source instanceof Node) { target.appendChild(source); - } else { - console.error('Invalid view source', source); + } else if (source !== null) { + throw `Invalid view source: ${source}`; } }