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,3 +1,4 @@
#include "Exception.hpp"
#include "TriangleMesh.hpp"
#include "ClipperUtils.hpp"
#include "Geometry.hpp"
@ -420,7 +421,7 @@ std::deque<uint32_t> TriangleMesh::find_unvisited_neighbors(std::vector<unsigned
{
// Make sure we're not operating on a broken mesh.
if (!this->repaired)
throw std::runtime_error("find_unvisited_neighbors() requires repair()");
throw Slic3r::RuntimeError("find_unvisited_neighbors() requires repair()");
// If the visited list is empty, populate it with false for every facet.
if (facet_visited.empty())
@ -683,7 +684,7 @@ void TriangleMeshSlicer::init(const TriangleMesh *_mesh, throw_on_cancel_callbac
{
mesh = _mesh;
if (! mesh->has_shared_vertices())
throw std::invalid_argument("TriangleMeshSlicer was passed a mesh without shared vertices.");
throw Slic3r::InvalidArgument("TriangleMeshSlicer was passed a mesh without shared vertices.");
throw_on_cancel();
facets_edges.assign(_mesh->stl.stats.number_of_facets * 3, -1);