Improved error reporting of the PlaceholderParser.

The PlaceholderParser is currently used by the GCode.cpp
and by Printer.cpp to generate a new name for the exported G-code or SVG file.
The PlaceholderParser::process() will throw a runtime_error with
a comprehensive error message.
The G-code export will include these error messages into the G-code text
with !!!!!! separators, and the GUI will inform the user, that the G-code
export failed.
This commit is contained in:
bubnikv 2017-12-05 15:54:24 +01:00
parent 1244fd09eb
commit 8746f84fa2
11 changed files with 190 additions and 141 deletions

View file

@ -1075,7 +1075,11 @@ void Print::_make_wipe_tower()
std::string Print::output_filename()
{
this->placeholder_parser.update_timestamp();
return this->placeholder_parser.process(this->config.output_filename_format.value, 0);
try {
return this->placeholder_parser.process(this->config.output_filename_format.value, 0);
} catch (std::runtime_error &err) {
throw std::runtime_error(std::string("Failed processing of the output_filename_format template.\n") + err.what());
}
}
std::string Print::output_filepath(const std::string &path)