From c7981b99486777c6fb93a4d59fefd269859a8c96 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sun, 26 Sep 2021 12:42:01 +0200 Subject: [PATCH] Throw an exception in filefuncs.cpp when a file is not found --- src/etc/filefuncs.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/etc/filefuncs.cpp b/src/etc/filefuncs.cpp index a5779bc..857b60c 100644 --- a/src/etc/filefuncs.cpp +++ b/src/etc/filefuncs.cpp @@ -9,10 +9,7 @@ string getFileContent(const string& file) fileStream.open(file, ios::in); if (fileStream.is_open()) while (getline(fileStream, lineinput)) { fullinput.append(lineinput + "\n"); - } else { - cout << "Could not open \"" << file << "\"." << endl; - exit(EXIT_FAILURE); - } + } else throw Yerbacon::Exception("Could not open \"" + file + "\"."); fileStream.close(); return fullinput; }