From 8d7f88b381e8e7bb7bbe5b536bc10ea397982895 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 25 Mar 2020 16:03:55 +0100 Subject: [PATCH] Imported error reporting when loading presets with option keys or option values that our poor software does not understand. This applies to configs added by some forks of slic3r, for example slic3r++ PrusaSlicer has encountered an error: Failed loading the preset file: #3909 --- src/libslic3r/Config.cpp | 2 +- src/libslic3r/Config.hpp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 6806f4f54..674410388 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -464,7 +464,7 @@ bool ConfigBase::set_deserialize_nothrow(const t_config_option_key &opt_key_src, void ConfigBase::set_deserialize(const t_config_option_key &opt_key_src, const std::string &value_src, bool append) { if (! this->set_deserialize_nothrow(opt_key_src, value_src, append)) - throw BadOptionTypeException("ConfigBase::set_deserialize() failed"); + throw BadOptionTypeException((boost::format("ConfigBase::set_deserialize() failed for parameter \"%1%\", value \"%2%\"") % opt_key_src % value_src).str()); } void ConfigBase::set_deserialize(std::initializer_list items) diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index f02caf226..87e020898 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -56,10 +56,9 @@ public: class BadOptionTypeException : public std::runtime_error { public: - BadOptionTypeException() : - std::runtime_error("Bad option type exception") {} - BadOptionTypeException(const char* message) : - std::runtime_error(message) {} + BadOptionTypeException() : std::runtime_error("Bad option type exception") {} + BadOptionTypeException(const std::string &message) : std::runtime_error(message) {} + BadOptionTypeException(const char* message) : std::runtime_error(message) {} }; // Type of a configuration value.