From faf249a53e9aa2b819cce50dbfb918489cf65c0f Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Tue, 25 Nov 2014 13:58:26 +0000 Subject: [PATCH] Give a more meaningful error message if vtk file couldn't be opened [[Imported from SVN: r9973]] --- dune/gfe/vtkfile.hh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dune/gfe/vtkfile.hh b/dune/gfe/vtkfile.hh index 71a59dbd..630480bd 100644 --- a/dune/gfe/vtkfile.hh +++ b/dune/gfe/vtkfile.hh @@ -184,8 +184,11 @@ namespace Dune { DUNE_THROW(Dune::NotImplemented, "You need TinyXML2 for vtk file reading!"); #else tinyxml2::XMLDocument doc; - if (doc.LoadFile(fullfilename.c_str()) != tinyxml2::XML_SUCCESS) + if (int error = doc.LoadFile(fullfilename.c_str()) != tinyxml2::XML_SUCCESS) + { + std::cout << "Error: " << error << std::endl; DUNE_THROW(Dune::IOError, "Couldn't open the file '" << fullfilename << "'"); + } // Get number of cells and number of points tinyxml2::XMLElement* pieceElement = doc.FirstChildElement( "VTKFile" )->FirstChildElement( "UnstructuredGrid" )->FirstChildElement( "Piece" ); @@ -354,4 +357,4 @@ namespace Dune { } -#endif \ No newline at end of file +#endif -- GitLab