Catch Standard_Failure before std::exception (OCCT >= 8) (#15826)

Co-authored-by: yw4z <ywsyildiz@gmail.com>
This commit is contained in:
Kenneth Raplee
2026-09-28 13:44:32 +03:00
committed by GitHub
co-authored by yw4z
parent 00bde9265b
commit f3a8f711fd
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -2673,10 +2673,10 @@ void CadDocument::apply_feature(TopoDS_Shape& result, bool& have_body,
ridge = pipe.Shape(); ridge = pipe.Shape();
have_ridge = !ridge.IsNull(); have_ridge = !ridge.IsNull();
} }
} catch (const Standard_Failure&) {
have_ridge = false; // OCCT failure — on OCCT >= 8 Standard_Failure derives from std::exception, so this handler must come first
} catch (const std::exception&) { } catch (const std::exception&) {
have_ridge = false; // fall back to the bare cylinder/bore below have_ridge = false; // fall back to the bare cylinder/bore below
} catch (const Standard_Failure&) {
have_ridge = false; // OCCT failure (not a std::exception) — must be caught here too
} }
if (f.thread_internal) { if (f.thread_internal) {
+4 -4
View File
@@ -4862,13 +4862,13 @@ void DesignPanel::on_import_mesh()
try { try {
shape = GeometryEngine::mesh_to_brep(mesh.its, MESH_IMPORT_TOLERANCE, shape = GeometryEngine::mesh_to_brep(mesh.its, MESH_IMPORT_TOLERANCE,
MESH_IMPORT_MERGE_ANGLE_DEG, stats); MESH_IMPORT_MERGE_ANGLE_DEG, stats);
} catch (const std::exception& e) { } catch (const Standard_Failure& e) { // on OCCT >= 8 Standard_Failure derives from std::exception — must precede that handler
fail(_L("Mesh conversion failed: ") + wxString::FromUTF8(e.what()));
return;
} catch (const Standard_Failure& e) { // OCCT throws outside std::exception
fail(_L("Mesh conversion failed: ") + wxString::FromUTF8( fail(_L("Mesh conversion failed: ") + wxString::FromUTF8(
e.GetMessageString() ? e.GetMessageString() : "OCCT error")); e.GetMessageString() ? e.GetMessageString() : "OCCT error"));
return; return;
} catch (const std::exception& e) {
fail(_L("Mesh conversion failed: ") + wxString::FromUTF8(e.what()));
return;
} }
if (shape.IsNull()) { fail(_L("Mesh conversion produced no geometry")); return; } if (shape.IsNull()) { fail(_L("Mesh conversion produced no geometry")); return; }