Skip to content

Commit

Permalink
Include filename in json parse failure exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jameseh96 committed Aug 14, 2023
1 parent 4a774f4 commit 76aaafb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pdu/block/index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ void Index::load(std::shared_ptr<Resource> res) {
throw std::runtime_error("Failed to open \"" + metaPath.string() +
"\" when trying to parse index meta");
}
meta = nlohmann::json::parse(metaF);
try {
meta = nlohmann::json::parse(metaF);
} catch (const nlohmann::json::exception& e) {
throw std::runtime_error(
"Failed to parse JSON index metadata file \"" +
metaPath.string() + "\" : " + e.what());
}
metaF.close();
}

Expand Down

0 comments on commit 76aaafb

Please sign in to comment.