WIP Refactoring of exceptions:

1) All slicer's exceptions are now derived from Slic3r::Exception.
2) New exceptions are defined for slicing errors.
3) Exceptions are propagated to the Plater to show.
It remains to modify the slicing back-end to throw the new SlicingError
exceptions instead of std::runtime_error and to show the other exceptions
by a message dialog instead of a notification.
This commit is contained in:
Vojtech Bubnik 2020-09-14 16:27:55 +02:00
parent 6ac1935932
commit 067cde85f1
59 changed files with 356 additions and 249 deletions

View file

@ -1,4 +1,5 @@
#include "PlaceholderParser.hpp"
#include "Exception.hpp"
#include "Flow.hpp"
#include <cstring>
#include <ctime>
@ -1303,7 +1304,7 @@ static std::string process_macro(const std::string &templ, client::MyContext &co
if (!context.error_message.empty()) {
if (context.error_message.back() != '\n' && context.error_message.back() != '\r')
context.error_message += '\n';
throw std::runtime_error(context.error_message);
throw Slic3r::RuntimeError(context.error_message);
}
return output;
}
@ -1319,7 +1320,7 @@ std::string PlaceholderParser::process(const std::string &templ, unsigned int cu
}
// Evaluate a boolean expression using the full expressive power of the PlaceholderParser boolean expression syntax.
// Throws std::runtime_error on syntax or runtime error.
// Throws Slic3r::RuntimeError on syntax or runtime error.
bool PlaceholderParser::evaluate_boolean_expression(const std::string &templ, const DynamicConfig &config, const DynamicConfig *config_override)
{
client::MyContext context;