Skip to content

Commit 597a6be

Browse files
committed
improve error logs
1 parent 378c500 commit 597a6be

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/evaluator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ std::pair<status_t, steps_t> Evaluator::check(const Program &p,
122122
out = mem.get(Program::OUTPUT_CELL);
123123
}
124124
} catch (const std::exception &e) {
125+
if (settings.print_as_b_file) {
126+
std::cout << std::string(e.what()) << std::endl;
127+
}
125128
result.first = ((int64_t)i >= num_terminating_terms) ? status_t::WARNING
126129
: status_t::ERROR;
127130
return result;

src/interpreter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ size_t Interpreter::run(const Program& p, Memory& mem, int64_t id) {
255255
}
256256
try {
257257
result = run(p, mem);
258-
} catch (const std::exception& e) {
258+
} catch (...) {
259259
if (id >= 0) {
260260
running_programs.erase(id);
261261
}
262-
throw e;
262+
std::rethrow_exception(std::current_exception());
263263
}
264264
if (id >= 0) {
265265
running_programs.erase(id);

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ int dispatch(Settings settings, const std::vector<std::string>& args) {
140140
Log::get().error("Option -s only allowed in evaluate command", true);
141141
}
142142
if (settings.print_as_b_file && cmd != "evaluate" && cmd != "eval" &&
143-
cmd != "check") {
144-
Log::get().error("Option -b only allowed in evaluate command", true);
143+
cmd != "check" && cmd != "maintain") {
144+
Log::get().error("Option -b not allowed for this command", true);
145145
}
146146
if (settings.parallel_mining && cmd != "mine") {
147147
Log::get().error("Option -p only allowed in mine command", true);

0 commit comments

Comments
 (0)