diff options
author | bubnikv <bubnikv@gmail.com> | 2020-03-07 18:31:14 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2020-03-07 18:31:14 +0300 |
commit | 76fecc91a5465d1167a1e105876f473e2bf449dd (patch) | |
tree | 943a481a65e492585b4056fce91d319a7cf6048c /src/slic3r/GUI/PresetBundle.cpp | |
parent | 93f2be7ac426c5acbaf7b30c1149d222b02ff58a (diff) |
Improved error reporting and error handling when loading
vendor config bundles into installation wizard.
Diffstat (limited to 'src/slic3r/GUI/PresetBundle.cpp')
-rw-r--r-- | src/slic3r/GUI/PresetBundle.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp index 3aa947f1b..2b5c062e6 100644 --- a/src/slic3r/GUI/PresetBundle.cpp +++ b/src/slic3r/GUI/PresetBundle.cpp @@ -703,7 +703,10 @@ void PresetBundle::load_config_file(const std::string &path) boost::nowide::ifstream ifs(path); boost::property_tree::read_ini(ifs, tree); } catch (const std::ifstream::failure &err) { - throw std::runtime_error(std::string("The config file cannot be loaded: ") + path + "\n\tReason: " + err.what()); + throw std::runtime_error(std::string("The Config Bundle cannot be loaded: ") + path + "\n\tReason: " + err.what()); + } catch (const boost::property_tree::file_parser_error &err) { + throw std::runtime_error((boost::format("Failed loading the Config Bundle \"%1%\": %2% at line %3%") + % err.filename() % err.message() % err.line()).str()); } catch (const std::runtime_error &err) { throw std::runtime_error(std::string("Failed loading the preset file: ") + path + "\n\tReason: " + err.what()); } @@ -1109,8 +1112,13 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla const VendorProfile *vendor_profile = nullptr; if (flags & (LOAD_CFGBNDLE_SYSTEM | LOAD_CFGBUNDLE_VENDOR_ONLY)) { auto vp = VendorProfile::from_ini(tree, path); - if (vp.num_variants() == 0) + if (vp.models.size() == 0) { + BOOST_LOG_TRIVIAL(error) << boost::format("Vendor bundle: `%1%`: No printer model defined.") % path; return 0; + } else if (vp.num_variants() == 0) { + BOOST_LOG_TRIVIAL(error) << boost::format("Vendor bundle: `%1%`: No printer variant defined") % path; + return 0; + } vendor_profile = &this->vendors.insert({vp.id, vp}).first->second; } |