From 2888e26ec62b271e4cb94350cf7ae8ae0f40ba76 Mon Sep 17 00:00:00 2001 From: Luca Saiu Date: Thu, 1 Sep 2022 16:37:18 +0200 Subject: [PATCH] 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. --- src/std_utils.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/std_utils.cc b/src/std_utils.cc index cb98e7d..6926cf2 100644 --- a/src/std_utils.cc +++ b/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();