From 5f17d44372c00b4437898bfabc76cf837094c366 Mon Sep 17 00:00:00 2001 From: Ian Bassi Date: Tue, 23 Dec 2025 12:14:27 -0300 Subject: [PATCH] Add context to Small Area Flow Compensation errors Prefixed error messages in SmallAreaInfillFlowCompensator with 'Small Area Flow Compensation' for improved clarity and debugging. Also rethrows exceptions after logging to ensure proper error propagation. --- .../GCode/SmallAreaInfillFlowCompensator.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.cpp b/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.cpp index e4e9694775..20377cfe8d 100644 --- a/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.cpp +++ b/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.cpp @@ -46,7 +46,7 @@ SmallAreaInfillFlowCompensator::SmallAreaInfillFlowCompensator(const Slic3r::GCo } } catch (...) { std::stringstream ss; - ss << "Error parsing data point in small area infill compensation model:" << line << std::endl; + ss << "Small Area Flow Compensation: Error parsing data point in small area infill compensation model:" << line << std::endl; throw Slic3r::InvalidArgument(ss.str()); } @@ -56,32 +56,33 @@ SmallAreaInfillFlowCompensator::SmallAreaInfillFlowCompensator(const Slic3r::GCo for (size_t i = 0; i < eLengths.size(); i++) { if (i == 0) { if (!nearly_equal(eLengths[i], 0.0)) { - throw Slic3r::InvalidArgument("First extrusion length for small area infill compensation model must be 0"); + throw Slic3r::InvalidArgument("Small Area Flow Compensation: First extrusion length for small area infill compensation model must be 0"); } } else { if (nearly_equal(eLengths[i], 0.0)) { - throw Slic3r::InvalidArgument("Only the first extrusion length for small area infill compensation model can be 0"); + throw Slic3r::InvalidArgument("Small Area Flow Compensation: Only the first extrusion length for small area infill compensation model can be 0"); } if (eLengths[i] <= eLengths[i - 1]) { - throw Slic3r::InvalidArgument("Extrusion lengths for subsequent points must be increasing"); + throw Slic3r::InvalidArgument("Small Area Flow Compensation: Extrusion lengths for subsequent points must be increasing"); } } } for (size_t i = 1; i < flowComps.size(); ++i) { if (flowComps[i] <= flowComps[i - 1]) { - throw Slic3r::InvalidArgument("Flow compensation factors must strictly increase with extrusion length"); + throw Slic3r::InvalidArgument("Small Area Flow Compensation: Flow compensation factors must strictly increase with extrusion length"); } } if (!flowComps.empty() && !nearly_equal(flowComps.back(), 1.0)) { - throw Slic3r::InvalidArgument("Final compensation factor for small area infill flow compensation model must be 1.0"); + throw Slic3r::InvalidArgument("Small Area Flow Compensation: Final compensation factor for small area infill flow compensation model must be 1.0"); } flowModel = std::make_unique(eLengths, flowComps); } catch (std::exception& e) { BOOST_LOG_TRIVIAL(error) << "Error parsing small area infill compensation model: " << e.what(); + throw; } }