summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrr- <rr-@sakuya.pl>2016-06-11 09:30:22 +0200
committerrr- <rr-@sakuya.pl>2016-06-11 17:36:02 +0200
commitabd679888af5dd32ecc2896ff4dddd3eed85f3d7 (patch)
treeedf4cedbc5ce223a24284d1ede59a806bbcdc455
parent8c952c08d0606f3e093eb6a409ce2bf12ea7e9b0 (diff)
client/general: make fatal errors fatal
-rw-r--r--client/js/api.js2
-rw-r--r--client/js/util/views.js7
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}`;
}
}