mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-31 18:52:04 +08:00
Replaced throwing strings with exception objects. Fixes #3433
This commit is contained in:
parent
e2b3d25edf
commit
9f0335b4b8
@ -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<const ConfigOptionFloat*>(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<ConfigOption*>(optv);
|
||||
} else {
|
||||
throw "Unknown option type";
|
||||
throw std::runtime_error("Unknown option type");
|
||||
}
|
||||
this->options[opt_key] = opt;
|
||||
return opt;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user