CommonIO: Make readFile() check if the file is not a directory and if not fail with a sensible exception rather than std::length_error

This commit is contained in:
Kamil Śliwak
2021-06-25 16:04:58 +02:00
parent cbf1c3ae69
commit 65e23ff171
6 changed files with 29 additions and 0 deletions
+5
View File
@@ -148,6 +148,11 @@ Allowed options)",
cerr << "File not found: " << path << endl;
return 1;
}
catch (NotAFile const&)
{
cerr << "Not a regular file: " << path << endl;
return 1;
}
}
else
input = readStandardInput();