Skip to content
Snippets Groups Projects
Commit 02291b39 authored by Matthew Webster's avatar Matthew Webster
Browse files

Improved exceptions for read_vest

parent 5c18b624
No related branches found
No related tags found
No related merge requests found
......@@ -2074,11 +2074,7 @@ ReturnMatrix read_vest(string p_fname)
ifstream in;
in.open(p_fname.c_str(), ios::in);
if(!in)
{
//cerr << "Unable to open " << p_fname << endl;
throw Exception("Unable to open vest file");
}
if(!in) throw Exception(string("Unable to open "+p_fname).c_str());
int numWaves = 0;
int numPoints = 0;
......@@ -2087,11 +2083,7 @@ ReturnMatrix read_vest(string p_fname)
while(true)
{
if(!in.good())
{
cerr << p_fname << "is not a valid vest file" << endl;
throw Exception("Not a valid vest file");
}
if(!in.good()) throw Exception(string(p_fname+" is not a valid vest file").c_str());
in >> str;
if(str == "/Matrix")
break;
......@@ -2111,7 +2103,8 @@ ReturnMatrix read_vest(string p_fname)
{
for(int j = 1; j <= numWaves; j++)
{
in >> p_mat(i,j);
if (!in.eof()) in >> p_mat(i,j);
else throw Exception(string(p_fname+" has insufficient data points").c_str());
}
}
......
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