summaryrefslogtreecommitdiff
path: root/hscript/key.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-07 19:10:34 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-07 19:10:34 -0500
commit476301116a3ce5818c157ff7efda83ce79b16b81 (patch)
tree76f97c18b2f3d87182525bd9afad5cfe7e46ccfd /hscript/key.cc
parent92b2d500937a985275cee574ba10803b8e949356 (diff)
downloadhorizon-476301116a3ce5818c157ff7efda83ce79b16b81.tar.gz
horizon-476301116a3ce5818c157ff7efda83ce79b16b81.tar.bz2
horizon-476301116a3ce5818c157ff7efda83ce79b16b81.tar.xz
horizon-476301116a3ce5818c157ff7efda83ce79b16b81.zip
hscript: Generalise BooleanKey failure mode for all keys
Diffstat (limited to 'hscript/key.cc')
-rw-r--r--hscript/key.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/hscript/key.cc b/hscript/key.cc
index 74406f6..a677670 100644
--- a/hscript/key.cc
+++ b/hscript/key.cc
@@ -12,8 +12,11 @@
#include <algorithm>
#include "key.hh"
+#include "util/output.hh"
-bool Horizon::Keys::BooleanKey::parse(const std::string what, bool *out) {
+bool Horizon::Keys::BooleanKey::parse(const std::string what,
+ const std::string where,
+ const std::string key, bool *out) {
std::string lower;
std::transform(what.begin(), what.end(), lower.begin(), ::tolower);
@@ -22,6 +25,8 @@ bool Horizon::Keys::BooleanKey::parse(const std::string what, bool *out) {
} else if(lower == "false" || lower == "no" || lower == "0") {
*out = false;
} else {
+ output_error(where, key + ": expected 'true' or 'false'",
+ "'" + what + "' is not a valid Boolean value");
return false;
}
return true;