Skip to content
Snippets Groups Projects
Commit 3a7fbc79 authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

Add exception to load_string_file when path does not exist

parent a2691ff3
No related branches found
No related tags found
2 merge requests!61Release 0.3.0,!59F better errors
......@@ -108,6 +108,10 @@ template <> auto getEnumValueFromName<Role>(const std::string &name) -> Role {
auto load_string_file(const path &file_path) -> std::string {
std::string result;
if (!exists(file_path)) {
throw std::runtime_error("File not found: " + file_path.string());
}
// adapted from boost::filesystem::load_string_file, which was removed in 1.84
std::ifstream file;
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
......
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