Skip to content
Snippets Groups Projects
Commit 4e34f975 authored by Timo Koch's avatar Timo Koch
Browse files

[io][container] Throw error if file couldn't be opened

parent 866f79a0
No related branches found
No related tags found
1 merge request!1967Feature/data input
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <fstream> #include <fstream>
#include <iterator> #include <iterator>
#include <dune/common/exceptions.hh>
namespace Dumux { namespace Dumux {
/*! /*!
...@@ -80,6 +82,8 @@ template<typename Container> ...@@ -80,6 +82,8 @@ template<typename Container>
Container readFileToContainer(const std::string& filename) Container readFileToContainer(const std::string& filename)
{ {
std::ifstream infile(filename, std::ios::in); std::ifstream infile(filename, std::ios::in);
if (!infile)
DUNE_THROW(Dune::IOError, "Could not open file: " << filename);
return readStreamToContainer<Container>(infile); return readStreamToContainer<Container>(infile);
} }
......
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