summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-07 16:46:48 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-07 16:46:48 -0500
commit4eb248671f38c914be640d3e53cbd71563f4737f (patch)
treed6f0305f5462f62bc594e31c01cd0bab53635c49
parente9df07a02ba5af1ebb2872aea2dd73282d6ac6c0 (diff)
downloadhorizon-4eb248671f38c914be640d3e53cbd71563f4737f.tar.gz
horizon-4eb248671f38c914be640d3e53cbd71563f4737f.tar.bz2
horizon-4eb248671f38c914be640d3e53cbd71563f4737f.tar.xz
horizon-4eb248671f38c914be640d3e53cbd71563f4737f.zip
hscript: Simply error logic
-rw-r--r--hscript/script.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/hscript/script.cc b/hscript/script.cc
index 487ea9b..038c9c1 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -114,32 +114,32 @@ const Script *Script::load(std::istream &sstream, ScriptOptions opts) {
}
}
- output_message("parser", "0", "installfile",
- std::to_string(errors) + " error(s), " +
- std::to_string(warnings) + " warning(s).",
- "", opts.test(Pretty));
-
- if(errors > 0) {
- delete the_script;
- return nullptr;
- }
-
if(sstream.fail() && !sstream.eof()) {
output_error("installfile:" + std::to_string(lineno + 1),
"line exceeds maximum length",
"Maximum length for line is " + std::to_string(LINE_MAX),
(opts.test(Pretty)));
- delete the_script;
- return nullptr;
+ errors++;
}
if(sstream.bad() && !sstream.eof()) {
output_error("installfile:" + std::to_string(lineno),
"I/O error reading installfile", "",
(opts.test(Pretty)));
+ errors++;
}
- return the_script;
+ output_message("parser", "0", "installfile",
+ std::to_string(errors) + " error(s), " +
+ std::to_string(warnings) + " warning(s).",
+ "", opts.test(Pretty));
+
+ if(errors > 0) {
+ delete the_script;
+ return nullptr;
+ } else {
+ return the_script;
+ }
}
bool Script::validate() const {