From f06e9856c41f562bef2ccc8e11f0618ef1e84484 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Wed, 2 Aug 2023 09:01:03 +0200
Subject: [PATCH] GUI importer: throw messages instead of failed ASSERT

---
 GUI/Model/FromCore/ItemizeSample.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/GUI/Model/FromCore/ItemizeSample.cpp b/GUI/Model/FromCore/ItemizeSample.cpp
index 7ced78c4d42..0bb06f74760 100644
--- a/GUI/Model/FromCore/ItemizeSample.cpp
+++ b/GUI/Model/FromCore/ItemizeSample.cpp
@@ -67,7 +67,7 @@ void set_PDF1D(InterferenceRadialParacrystalItem* parent, const IProfile1D* ipdf
         item->setEta(pdf->eta());
         parent->setPDFType(item);
     } else
-        ASSERT(false);
+        throw std::runtime_error("Profile1D not supported by GUI importer");
 }
 
 // note: SetterPDF(1|2)Type are needed because template template parameter must be classes
@@ -122,7 +122,7 @@ void set_PDF2D(Interference2DParacrystalItem* parent, const IProfile2D* pdf)
         item->setGamma(Units::rad2deg(pdf_voigt->gamma()));
         item->setEta(pdf_voigt->eta());
     } else
-        ASSERT(false);
+        throw std::runtime_error("Profile2D not supported by GUI importer");
 }
 
 void set_DecayFunction1D(Interference1DLatticeItem* parent, const IProfile1D* ipdf)
@@ -145,7 +145,7 @@ void set_DecayFunction1D(Interference1DLatticeItem* parent, const IProfile1D* ip
         item->setEta(pdf->eta());
         parent->setDecayFunctionType(item);
     } else
-        ASSERT(false);
+        throw std::runtime_error("Profile1D not supported by GUI importer");
 }
 
 void set_DecayFunction2D(Interference2DLatticeItem* parent, const IProfile2D* pdf)
@@ -170,7 +170,7 @@ void set_DecayFunction2D(Interference2DLatticeItem* parent, const IProfile2D* pd
         item->setEta(pdf_voigt->eta());
         parent->setDecayFunctionType(item);
     } else
-        ASSERT(false);
+        throw std::runtime_error("Profile2D not supported by GUI importer");
 }
 
 void set_2DLatticeParameters(Interference2DAbstractLatticeItem* parent, const Lattice2D& lattice)
@@ -372,7 +372,7 @@ void set_Interference(ParticleLayoutItem* parent, const IInterference* interfere
         set_RadialParacrystalItem(item, *itf);
         parent->setInterference(item);
     } else
-        ASSERT(false); // missing implementation for interference type
+        throw std::runtime_error("Interference function not supported by GUI importer");
 }
 
 void set_FormFactor(std::variant<ParticleItem*, MesocrystalItem*> parent, const IFormFactor* ff)
@@ -524,7 +524,7 @@ void set_FormFactor(std::variant<ParticleItem*, MesocrystalItem*> parent, const
         auto* item = addFormFactorItem<PlatonicTetrahedronItem>(parent);
         item->setEdge(f->edge());
     } else
-        ASSERT(false);
+        throw std::runtime_error("Formfactor not supported by GUI importer");
 }
 
 MaterialItem* findMaterialItem(MaterialModel& matItems, const ISampleNode* node)
-- 
GitLab