Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2018-05-01 11:35:07 +0300
committerVojtech Kral <vojtech@kral.hk>2018-05-01 12:20:44 +0300
commit4758b68e55e072b10dfc77413e11d01ba64af600 (patch)
treee694fea24c0d6f602a37c455dfbe7141e5655de6 /xs
parent28effac0f169e7fa9e143b40e4a6762e97253f53 (diff)
Fix: Turn two Preset & PresetUpdater exceptions into error logs
Diffstat (limited to 'xs')
-rw-r--r--xs/src/slic3r/GUI/Preset.cpp10
-rw-r--r--xs/src/slic3r/Utils/PresetUpdater.cpp4
2 files changed, 9 insertions, 5 deletions
diff --git a/xs/src/slic3r/GUI/Preset.cpp b/xs/src/slic3r/GUI/Preset.cpp
index eca809ec1..bc59ac2f9 100644
--- a/xs/src/slic3r/GUI/Preset.cpp
+++ b/xs/src/slic3r/GUI/Preset.cpp
@@ -18,6 +18,7 @@
#include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/locale.hpp>
+#include <boost/log/trivial.hpp>
#include <wx/image.h>
#include <wx/choice.h>
@@ -120,14 +121,15 @@ VendorProfile VendorProfile::from_ini(const ptree &tree, const boost::filesystem
model.id = section.first.substr(printer_model_key.size());
model.name = section.second.get<std::string>("name", model.id);
section.second.get<std::string>("variants", "");
+ const auto variants_field = section.second.get<std::string>("variants", "");
std::vector<std::string> variants;
- if (Slic3r::unescape_strings_cstyle(section.second.get<std::string>("variants", ""), variants)) {
+ if (Slic3r::unescape_strings_cstyle(variants_field, variants)) {
for (const std::string &variant_name : variants) {
if (model.variant(variant_name) == nullptr)
model.variants.emplace_back(VendorProfile::PrinterVariant(variant_name));
}
} else {
- // Log error? // XXX
+ BOOST_LOG_TRIVIAL(error) << boost::format("Vendor bundle: `%1%`: Malformed variants field: `%2%`") % id % variants_field;
}
if (! model.id.empty() && ! model.variants.empty())
res.models.push_back(std::move(model));
@@ -387,7 +389,9 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
// Remove the .ini suffix.
name.erase(name.size() - 4);
if (this->find_preset(name, false)) {
- errors_cummulative += "The user preset \"" + name + "\" cannot be loaded. A system preset of the same name has already been loaded.";
+ // This happens when there's is a preset (most likely legacy one) with the same name as a system preset
+ // that's already been loaded from a bundle.
+ BOOST_LOG_TRIVIAL(warning) << "Preset already present, not loading: " << name;
continue;
}
try {
diff --git a/xs/src/slic3r/Utils/PresetUpdater.cpp b/xs/src/slic3r/Utils/PresetUpdater.cpp
index 9c5fe0748..3b786e0d6 100644
--- a/xs/src/slic3r/Utils/PresetUpdater.cpp
+++ b/xs/src/slic3r/Utils/PresetUpdater.cpp
@@ -252,7 +252,7 @@ void PresetUpdater::priv::sync_config(const std::set<VendorProfile> vendors) con
// See if a there's a new version to download
const auto recommended_it = new_index.recommended();
if (recommended_it == new_index.end()) {
- BOOST_LOG_TRIVIAL(error) << "No recommended version for vendor: " << vendor.name << ", invalid index?";
+ BOOST_LOG_TRIVIAL(error) << boost::format("No recommended version for vendor: %1%, invalid index?") % vendor.name;
continue;
}
const auto recommended = recommended_it->config_version;
@@ -326,7 +326,7 @@ Updates PresetUpdater::priv::get_config_updates() const
const auto recommended = idx.recommended();
if (recommended == idx.end()) {
- throw std::runtime_error((boost::format("Invalid index: `%1%`") % idx.vendor()).str());
+ BOOST_LOG_TRIVIAL(error) << boost::format("No recommended version for vendor: %1%, invalid index?") % idx.vendor();
}
BOOST_LOG_TRIVIAL(debug) << boost::format("Vendor: %1%, version installed: %2%, version cached: %3%")