Skip to content
Snippets Groups Projects
Commit faf249a5 authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

Give a more meaningful error message if vtk file couldn't be opened

[[Imported from SVN: r9973]]
parent 1c35446f
No related branches found
No related tags found
No related merge requests found
...@@ -184,8 +184,11 @@ namespace Dune { ...@@ -184,8 +184,11 @@ namespace Dune {
DUNE_THROW(Dune::NotImplemented, "You need TinyXML2 for vtk file reading!"); DUNE_THROW(Dune::NotImplemented, "You need TinyXML2 for vtk file reading!");
#else #else
tinyxml2::XMLDocument doc; 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 << "'"); DUNE_THROW(Dune::IOError, "Couldn't open the file '" << fullfilename << "'");
}
// Get number of cells and number of points // Get number of cells and number of points
tinyxml2::XMLElement* pieceElement = doc.FirstChildElement( "VTKFile" )->FirstChildElement( "UnstructuredGrid" )->FirstChildElement( "Piece" ); tinyxml2::XMLElement* pieceElement = doc.FirstChildElement( "VTKFile" )->FirstChildElement( "UnstructuredGrid" )->FirstChildElement( "Piece" );
...@@ -354,4 +357,4 @@ namespace Dune { ...@@ -354,4 +357,4 @@ namespace Dune {
} }
#endif #endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment