diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/Config.cpp index da33b2fcd..abcc4afc1 100644 --- a/xs/src/libslic3r/Config.cpp +++ b/xs/src/libslic3r/Config.cpp @@ -256,7 +256,7 @@ ConfigBase::apply_only(const ConfigBase &other, const t_config_option_keys &opt_ for (const t_config_option_key &opt_key : opt_keys) { ConfigOption* my_opt = this->option(opt_key, true); if (my_opt == NULL) { - if (ignore_nonexistent == false) throw "Attempt to apply non-existent option"; + if (ignore_nonexistent == false) throw UnknownOptionException(); continue; } @@ -339,7 +339,7 @@ ConfigBase::get_abs_value(const t_config_option_key &opt_key) const { } else if (const ConfigOptionFloat* optv = dynamic_cast(opt)) { return optv->value; } else { - throw "Not a valid option type for get_abs_value()"; + throw std::runtime_error("Not a valid option type for get_abs_value()"); } } @@ -487,7 +487,7 @@ DynamicConfig::optptr(const t_config_option_key &opt_key, bool create) { optv->keys_map = &optdef->enum_keys_map; opt = static_cast(optv); } else { - throw "Unknown option type"; + throw std::runtime_error("Unknown option type"); } this->options[opt_key] = opt; return opt; diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index d3127f917..d3393250e 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -349,8 +349,8 @@ Model::duplicate_objects(size_t copies_num, coordf_t dist, const BoundingBoxf* b void Model::duplicate_objects_grid(size_t x, size_t y, coordf_t dist) { - if (this->objects.size() > 1) throw "Grid duplication is not supported with multiple objects"; - if (this->objects.empty()) throw "No objects!"; + if (this->objects.size() > 1) throw std::runtime_error("Grid duplication is not supported with multiple objects"); + if (this->objects.empty()) throw std::runtime_error("No objects!"); ModelObject* object = this->objects.front(); object->clear_instances();