Improved error reporting when importing various configuration files:

1) Slic3r::RuntimeError was replaced with ConfigurationError,
   all exceptions thrown by the configuration layer are derived
   from ConfigurationError.
2) When parsing configuration files, ConfigurationError is catched and
   rethrown extended with the file name being parsed.
This commit is contained in:
Vojtech Bubnik 2021-06-29 15:41:47 +02:00
parent 4cbe7a9545
commit 965c2f2c55
5 changed files with 181 additions and 113 deletions

View file

@ -2337,6 +2337,10 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
if (obj->name.empty())
obj->name = fs::path(obj->input_file).filename().string();
}
} catch (const ConfigurationError &e) {
std::string message = GUI::format(_L("Failed loading file \"%1%\" due to an invalid configuration."), filename.string()) + "\n\n" + e.what();
GUI::show_error(q, message);
continue;
} catch (const std::exception &e) {
GUI::show_error(q, e.what());
continue;