json-related refactor

This commit is contained in:
MihailRis
2024-05-20 03:06:26 +03:00
parent 45862269e7
commit 7fdacffe53
7 changed files with 30 additions and 35 deletions
+2 -2
View File
@@ -1,5 +1,6 @@
#include "files.hpp"
#include "../coders/commons.hpp"
#include "../coders/json.hpp"
#include "../coders/gzip.hpp"
#include "../util/stringutil.hpp"
@@ -107,8 +108,7 @@ bool files::write_binary_json(fs::path filename, const dynamic::Map* obj, bool c
std::shared_ptr<dynamic::Map> files::read_json(fs::path filename) {
std::string text = files::read_string(filename);
try {
auto obj = json::parse(filename.string(), text);
return obj;
return json::parse(filename.string(), text);;
} catch (const parsing_error& error) {
std::cerr << error.errorLog() << std::endl;
throw std::runtime_error("could not to parse "+filename.string());