pEp::Utils::file_read: throw exception instead of calling exit on failure

This fixes the JSON server adapter which has just switched from the old slurp
module to this functionality, which was not completely compatible because of its
way of failing.
pull/1/head
Luca Saiu 3 months ago
parent af3304f29e
commit 2888e26ec6
  1. 3
      src/std_utils.cc

@ -170,8 +170,7 @@ namespace pEp {
auto ss = ostringstream{};
ifstream input_file(filename);
if (!input_file.is_open()) {
runtime_error e{ "Could not open the file: " + filename };
exit(EXIT_FAILURE);
throw runtime_error ("Could not open the file: " + filename);
}
ss << input_file.rdbuf();
return ss.str();

Loading…
Cancel
Save