Throw an exception in filefuncs.cpp when a file is not found
This commit is contained in:
parent
43b4629a6d
commit
c7981b9948
@ -9,10 +9,7 @@ string getFileContent(const string& file)
|
|||||||
fileStream.open(file, ios::in);
|
fileStream.open(file, ios::in);
|
||||||
if (fileStream.is_open()) while (getline(fileStream, lineinput)) {
|
if (fileStream.is_open()) while (getline(fileStream, lineinput)) {
|
||||||
fullinput.append(lineinput + "\n");
|
fullinput.append(lineinput + "\n");
|
||||||
} else {
|
} else throw Yerbacon::Exception("Could not open \"" + file + "\".");
|
||||||
cout << "Could not open \"" << file << "\"." << endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
fileStream.close();
|
fileStream.close();
|
||||||
return fullinput;
|
return fullinput;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user