diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp b/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp
index bc736215ddfa37374a9ed7a49dee3613ee45e402..ef1abea67f331cfa01871f80cedddd666fa185c1 100644
--- a/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp
+++ b/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp
@@ -340,19 +340,13 @@ void DiagramList::setList(std::vector<std::pair<float, float>> const& coords)
         return;
 
     this->_startDate = QDateTime();
-    std::size_t nCoords = coords.size();
-    for (std::size_t i = 0; i < nCoords; i++)
-        _coords.push_back(coords[i]);
-
+    std::copy(coords.begin(), coords.end(), std::back_inserter(_coords));
     update();
 }
 
-std::size_t DiagramList::size()
+std::size_t DiagramList::size() const
 {
-    if (!(_coords.empty()))
-        return _coords.size();
-
-    return 0;
+    return _coords.size();
 }
 
 void DiagramList::update()
diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramList.h b/Applications/DataExplorer/DataView/DiagramView/DiagramList.h
index 25056016fe80276c0e002d15da14f5764275a9cb..66c43bd065e6ca57563ef0a91f61d8d92a40a3cc 100644
--- a/Applications/DataExplorer/DataView/DiagramView/DiagramList.h
+++ b/Applications/DataExplorer/DataView/DiagramView/DiagramList.h
@@ -141,7 +141,7 @@ public:
     void setYUnit(QString unit) { _yUnit = unit; }
 
     /// Returns the number of data points.
-    std::size_t size();
+    std::size_t size() const;
 
     /// Returns the width of the bounding box of all data points within the list.
     double width() const { return _maxX - _minX; }
diff --git a/Applications/DataExplorer/DataView/FemConditionModel.h b/Applications/DataExplorer/DataView/FemConditionModel.h
index 278cf890dddc39f33048de23bd0eb5c2c83dfa13..66b0dc24571a856ef40ddfcd12e011cd3af0ab8b 100644
--- a/Applications/DataExplorer/DataView/FemConditionModel.h
+++ b/Applications/DataExplorer/DataView/FemConditionModel.h
@@ -11,7 +11,7 @@
 #pragma once
 
 #include "Applications/DataHolderLib/FemCondition.h"
-#include "TreeModel.h"
+#include "Applications/DataExplorer/Base/TreeModel.h"
 
 /**
  * \brief A model for the display of information from boundary conditions and
@@ -24,7 +24,7 @@ class FemConditionModel : public TreeModel
 public:
     FemConditionModel(QObject* parent = nullptr);
 
-    int columnCount() const { return 2; }
+    int columnCount(const QModelIndex& /*parent*/ = QModelIndex()) const { return 2; }
 
 public slots:
     /// Clears the tree.
diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp
index 62c78169fe10b6b66b0530fc9430590fcb4842b3..b0a850888ba5002266faf9b1de6102d88dc3699a 100644
--- a/Applications/DataExplorer/mainwindow.cpp
+++ b/Applications/DataExplorer/mainwindow.cpp
@@ -497,8 +497,18 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName)
         else if (fi.suffix().toLower() == "gml")
         {
             GeoLib::IO::XmlGmlInterface xml(_project.getGEOObjects());
-            if (!xml.readFile(fileName))
-                OGSError::box("Failed to load geometry.\n Please see console for details.");
+            try
+            {
+                if (!xml.readFile(fileName))
+                    OGSError::box(
+                        "Failed to load geometry.\n Please see console for "
+                        "details.");
+            }
+            catch (std::runtime_error const& err)
+            {
+                OGSError::box(err.what(),
+                              "Failed to read file `" + fileName + "'");
+            }
         }
         // OpenGeoSys observation station files (incl. boreholes)
         else if (fi.suffix().toLower() == "stn")
diff --git a/Applications/FileIO/FEFLOW/FEFLOWMeshInterface.cpp b/Applications/FileIO/FEFLOW/FEFLOWMeshInterface.cpp
index 9f31d9ced2455e5358a65242a1520d6cb635c25b..8f67c6df774e2195ce6c8d6ea2f2f19f33df69f2 100644
--- a/Applications/FileIO/FEFLOW/FEFLOWMeshInterface.cpp
+++ b/Applications/FileIO/FEFLOW/FEFLOWMeshInterface.cpp
@@ -454,7 +454,7 @@ MeshLib::Element* FEFLOWMeshInterface::readElement(
     ss >> ele_type;
 
     MeshLib::MeshElemType elem_type;
-    int n_nodes_of_element;
+    std::size_t n_nodes_of_element;
     switch (ele_type)
     {
         case 6:
diff --git a/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp b/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp
index f37e62bd8c3bfb24128e528d29ea9a773b1c7e6e..9a2b1a7118a3cf27b99676597256912ef162d07f 100644
--- a/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp
+++ b/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp
@@ -18,13 +18,14 @@
 #include <QtXml/QDomDocument>
 #include <logog/include/logog.hpp>
 
+#include "Applications/DataExplorer/Base/OGSError.h"
+#include "Applications/DataHolderLib/FemCondition.h"
+
 #include "BaseLib/BuildInfo.h"
 #include "BaseLib/FileFinder.h"
 #include "BaseLib/FileTools.h"
 #include "BaseLib/IO/Writer.h"
 
-#include "Applications/DataHolderLib/FemCondition.h"
-
 #include "GeoLib/GEOObjects.h"
 
 #include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h"
@@ -75,7 +76,15 @@ int XmlPrjInterface::readFile(const QString& fileName)
         if (node_name == "geometry")
         {
             GeoLib::IO::XmlGmlInterface gml(_project.getGEOObjects());
-            gml.readFile(QString(path + file_name));
+            try
+            {
+                gml.readFile(QString(path + file_name));
+            }
+            catch (std::runtime_error const& err)
+            {
+                OGSError::box(err.what(),
+                              "Failed to read file `" + fileName + "'");
+            }
         }
         else if (node_name == "stations")
         {
diff --git a/Applications/Utils/GeoTools/MoveGeometry.cpp b/Applications/Utils/GeoTools/MoveGeometry.cpp
index ee5f58e3a68600faa97211f86e74bbcaffdb8798..573ee81377489850f22a017e5ef2aa110d3e8c80 100644
--- a/Applications/Utils/GeoTools/MoveGeometry.cpp
+++ b/Applications/Utils/GeoTools/MoveGeometry.cpp
@@ -50,8 +50,17 @@ int main(int argc, char *argv[])
 
     GeoLib::GEOObjects geo_objects;
     GeoLib::IO::XmlGmlInterface xml(geo_objects);
-    if (!xml.readFile(geo_input_arg.getValue()))
+    try
     {
+        if (!xml.readFile(geo_input_arg.getValue()))
+        {
+            return EXIT_FAILURE;
+        }
+    }
+    catch (std::runtime_error const& err)
+    {
+        ERR("Failed to read file `%s'.", geo_input_arg.getValue().c_str());
+        ERR("%s", err.what());
         return EXIT_FAILURE;
     }
 
diff --git a/Applications/Utils/GeoTools/TriangulatePolyline.cpp b/Applications/Utils/GeoTools/TriangulatePolyline.cpp
index f643e4fe01e9ccaf864618c845993872c8029a03..46484850ee6c79a7707968cc3adff5ce4d507dc2 100644
--- a/Applications/Utils/GeoTools/TriangulatePolyline.cpp
+++ b/Applications/Utils/GeoTools/TriangulatePolyline.cpp
@@ -56,9 +56,18 @@ int main(int argc, char *argv[])
 
     GeoLib::GEOObjects geo_objects;
     GeoLib::IO::XmlGmlInterface xml(geo_objects);
-    if (!xml.readFile(file_name))
+    try
     {
-        ERR ("Failed to load geometry file.");
+        if (!xml.readFile(file_name))
+        {
+            ERR("Failed to load geometry file.");
+            return EXIT_FAILURE;
+        }
+    }
+    catch (std::runtime_error const& err)
+    {
+        ERR("Failed to read file `%s'.", file_name.c_str());
+        ERR("%s", err.what());
         return EXIT_FAILURE;
     }
 
diff --git a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp
index 9088768c7a4ce3dcb540055b87b5851b16c31e5c..dbcda6beab56113efb4dbe5353d8392f89973b97 100644
--- a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp
+++ b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp
@@ -53,11 +53,21 @@ void OGSFileConverter::convertGML2GLI(const QStringList &input, const QString &o
         if (fileExists(output_str))
             continue;
 
-        if (!xml.readFile(input_string))
+        try
         {
-            OGSError::box("Error reading geometry " + fi.fileName());
+            if (!xml.readFile(input_string))
+            {
+                OGSError::box("Error reading geometry " + fi.fileName());
+                continue;
+            }
+        }
+        catch (std::runtime_error const& err)
+        {
+            OGSError::box(err.what(),
+                          "Failed to read file `" + input_string + "'");
             continue;
         }
+
         std::vector<std::string> geo_names;
         geo_objects.getGeometryNames(geo_names);
         FileIO::Legacy::writeGLIFileV4(output_str, geo_names[0], geo_objects);
diff --git a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp
index e459683d5c020a742090296002262322ce97d12f..2b6b60696cb59404ba8b34ad2e05c37331a55a89 100644
--- a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp
+++ b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp
@@ -164,9 +164,22 @@ void BoostXmlGmlInterface::readPolylines(
             BaseLib::insertIfKeyUniqueElseError(ply_names, *p_name, polylines.size()-1,
                 "The polyline name is not unique.");
 
+            auto accessOrError = [this, &p_name](auto pt_idx) {
+                auto search = _idx_map.find(pt_idx);
+                if (search == _idx_map.end())
+                {
+                    OGS_FATAL(
+                        "Polyline `%s' contains the point id `%d', but the "
+                        "id is not in the point list.",
+                        p_name->c_str(), pt_idx);
+                }
+                return search->second;
+            };
+
             //! \ogs_file_param{gml__polylines__polyline__pnt}
-            for (auto const pt : pl.getConfigParameterList<std::size_t>("pnt")) {
-                polylines.back()->addPoint(pnt_id_map[_idx_map[pt]]);
+            for (auto const pt : pl.getConfigParameterList<std::size_t>("pnt"))
+            {
+                polylines.back()->addPoint(pnt_id_map[accessOrError(pt)]);
             }
         }
         else
@@ -213,9 +226,21 @@ void BoostXmlGmlInterface::readSurfaces(
                 //! \ogs_file_attr{gml__surfaces__surface__element__p3}
                 auto const p3_attr = element.getConfigAttribute<std::size_t>("p3");
 
-                auto const p1 = pnt_id_map[_idx_map[p1_attr]];
-                auto const p2 = pnt_id_map[_idx_map[p2_attr]];
-                auto const p3 = pnt_id_map[_idx_map[p3_attr]];
+                auto accessOrError = [this, &s_name](std::size_t pt_idx) {
+                    auto search = _idx_map.find(pt_idx);
+                    if (search == _idx_map.end())
+                    {
+                        OGS_FATAL(
+                            "The element list of the surface `%s' contains the "
+                            "invalid point id `%d'.",
+                            s_name->c_str(), pt_idx);
+                    }
+                    return search->second;
+                };
+
+                auto const p1 = pnt_id_map[accessOrError(p1_attr)];
+                auto const p2 = pnt_id_map[accessOrError(p2_attr)];
+                auto const p3 = pnt_id_map[accessOrError(p3_attr)];
                 surfaces.back()->addTriangle(p1,p2,p3);
             }
         }
diff --git a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp
index 7253085b97a0dc9ef255f8eff00faa004d96734a..0bbcd9ce59c1d06776aab2d517de2355a0aafd4e 100644
--- a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp
+++ b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp
@@ -113,10 +113,19 @@ int XmlGmlInterface::readFile(const QString &fileName)
         }
         else if (nodeName.compare("polylines") == 0)
         {
-            readPolylines(
-                type_node, polylines.get(), *_geo_objs.getPointVec(gliName),
-                _geo_objs.getPointVecObj(gliName)->getIDMap(), ply_names.get());
-
+            try
+            {
+                readPolylines(type_node, polylines.get(),
+                              *_geo_objs.getPointVec(gliName),
+                              _geo_objs.getPointVecObj(gliName)->getIDMap(),
+                              ply_names.get());
+            }
+            catch (std::runtime_error const& err)
+            {
+                // further reading is aborted and it is necessary to clean up
+                _geo_objs.removePointVec(gliName);
+                throw;
+            }
             // if names-map is empty, set it to nullptr because it is not needed
             if (ply_names->empty())
             {
@@ -125,9 +134,20 @@ int XmlGmlInterface::readFile(const QString &fileName)
         }
         else if (nodeName.compare("surfaces") == 0)
         {
-            readSurfaces(
-                type_node, surfaces.get(), *_geo_objs.getPointVec(gliName),
-                _geo_objs.getPointVecObj(gliName)->getIDMap(), sfc_names.get());
+            try
+            {
+                readSurfaces(type_node, surfaces.get(),
+                             *_geo_objs.getPointVec(gliName),
+                             _geo_objs.getPointVecObj(gliName)->getIDMap(),
+                             sfc_names.get());
+            }
+            catch (std::runtime_error const& err)
+            {
+                // further reading is aborted and it is necessary to clean up
+                _geo_objs.removePointVec(gliName);
+                _geo_objs.removePolylineVec(gliName);
+                throw;
+            }
 
             // if names-map is empty, set it to nullptr because it is not needed
             if (sfc_names->empty())
@@ -200,9 +220,27 @@ void XmlGmlInterface::readPolylines(
         }
 
         QDomElement point = polyline.firstChildElement();
+        auto accessOrError =
+            [this, &polyline](auto pt_idx) {
+                auto search = _idx_map.find(pt_idx);
+                if (search == _idx_map.end())
+                {
+                    std::string polyline_name;
+                    if (polyline.hasAttribute("name"))
+                        polyline_name =
+                            polyline.attribute("name").toStdString();
+                    OGS_FATAL(
+                        "Polyline `%s' contains the point id `%d', but the "
+                        "id is not in the point list.",
+                        polyline_name.c_str(), pt_idx);
+                }
+                return search->second;
+            };
+
         while (!point.isNull())
         {
-            (*polylines)[idx]->addPoint(pnt_id_map[_idx_map[point.text().toInt()]]);
+            (*polylines)[idx]->addPoint(
+                pnt_id_map[accessOrError(point.text().toInt())]);
             point = point.nextSiblingElement();
         }
 
@@ -226,12 +264,32 @@ void XmlGmlInterface::readSurfaces(
             sfc_names->insert( std::pair<std::string, std::size_t>( surface.attribute("name").toStdString(),
                                                                     surfaces->size()-1) );
 
+        auto accessOrError =
+            [this, &surface](auto pt_idx) {
+                auto search = _idx_map.find(pt_idx);
+                if (search == _idx_map.end())
+                {
+                    std::string surface_name;
+                    if (surface.hasAttribute("name"))
+                        surface_name =
+                            surface.attribute("name").toStdString();
+                    OGS_FATAL(
+                        "Surface `%s' contains the point id `%d', but the "
+                        "id is not in the point list.",
+                        surface_name.c_str(), pt_idx);
+                }
+                return search->second;
+            };
+
         QDomElement element = surface.firstChildElement();
         while (!element.isNull())
         {
-            std::size_t p1 = pnt_id_map[_idx_map[element.attribute("p1").toInt()]];
-            std::size_t p2 = pnt_id_map[_idx_map[element.attribute("p2").toInt()]];
-            std::size_t p3 = pnt_id_map[_idx_map[element.attribute("p3").toInt()]];
+            std::size_t p1 =
+                pnt_id_map[accessOrError(element.attribute("p1").toInt())];
+            std::size_t p2 =
+                pnt_id_map[accessOrError(element.attribute("p2").toInt())];
+            std::size_t p3 =
+                pnt_id_map[accessOrError(element.attribute("p3").toInt())];
             surfaces->back()->addTriangle(p1,p2,p3);
             element = element.nextSiblingElement();
         }
diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake
index fe6a9672d88884cbcf509b343863ef8ae9704f44..85513997827d9a524eed85a97282fd285428718c 100644
--- a/scripts/cmake/CompilerSetup.cmake
+++ b/scripts/cmake/CompilerSetup.cmake
@@ -47,9 +47,13 @@ if(COMPILER_IS_GCC OR COMPILER_IS_CLANG OR COMPILER_IS_INTEL)
     add_compile_options(
         -Wall
         -Wextra
-        -Wno-c++98-compat-pedantic
         -DOPENMP_LOOP_TYPE=unsigned
     )
+    if(NOT COMPILER_IS_INTEL)
+        add_compile_options(
+            -Wno-c++98-compat-pedantic
+        )
+    endif()
 
     # Profiling
     if(OGS_PROFILE)