From e93caf1a9248e81f63551798bbad3e4ed4fa8fa9 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 26 Feb 2025 06:21:08 +0100 Subject: [PATCH] Seq arrange better exception handling --- .../include/libseqarrange/seq_interface.hpp | 1 - src/libseqarrange/src/seq_preprocess.cpp | 2 +- src/slic3r/GUI/Jobs/SeqArrangeJob.cpp | 9 ++++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libseqarrange/include/libseqarrange/seq_interface.hpp b/src/libseqarrange/include/libseqarrange/seq_interface.hpp index cfca3f6d28..261ea310b1 100644 --- a/src/libseqarrange/include/libseqarrange/seq_interface.hpp +++ b/src/libseqarrange/include/libseqarrange/seq_interface.hpp @@ -28,7 +28,6 @@ using namespace Slic3r; namespace Sequential { class ObjectTooLargeException : public std::runtime_error { public: explicit ObjectTooLargeException(const std::string& msg) : std::runtime_error(msg) {}}; - class InternalErrorException : public std::runtime_error { public: explicit InternalErrorException(const std::string& msg) : std::runtime_error(msg) {} }; diff --git a/src/libseqarrange/src/seq_preprocess.cpp b/src/libseqarrange/src/seq_preprocess.cpp index aa3a846f06..8c697c8562 100644 --- a/src/libseqarrange/src/seq_preprocess.cpp +++ b/src/libseqarrange/src/seq_preprocess.cpp @@ -742,7 +742,7 @@ void prepare_ExtruderPolygons(const SolverConfiguration &solver } else { - throw InternalErrorException("MISMATCH BETWEEN OBJECT AND PRINTER SLICE HEIGHTS."); + throw std::runtime_error("MISMATCH BETWEEN OBJECT AND PRINTER SLICE HEIGHTS."); } } } diff --git a/src/slic3r/GUI/Jobs/SeqArrangeJob.cpp b/src/slic3r/GUI/Jobs/SeqArrangeJob.cpp index a9d15f0b5d..bdf9964665 100644 --- a/src/slic3r/GUI/Jobs/SeqArrangeJob.cpp +++ b/src/slic3r/GUI/Jobs/SeqArrangeJob.cpp @@ -33,8 +33,11 @@ void SeqArrangeJob::process(Ctl& ctl) } ); } catch (const SeqArrangeJobException&) { - // The task was canceled. Just make sure that the progress notification disappears. - ctl.update_status(100, ""); + ctl.update_status(100, ""); // Hide progress notification. + } + catch (const std::exception&) { + ctl.update_status(100, ""); // Hide progress notification. + throw; } } @@ -60,7 +63,7 @@ void SeqArrangeJob::finalize(bool canceled, std::exception_ptr& eptr) dlg.ShowModal(); error = true; eptr = nullptr; // The exception is handled. - } catch (const Sequential::InternalErrorException& ex) { + } catch (const std::runtime_error& ex) { ErrorDialog dlg(wxGetApp().plater(), GUI::format_wxstr(_L("Internal error: %1%"), ex.what()), false); dlg.ShowModal(); error = true;