Skip to content

Commit

Permalink
Add error for invalid config file name
Browse files Browse the repository at this point in the history
  • Loading branch information
angela28chen committed Aug 11, 2023
1 parent 7fe93d3 commit 5ff18a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ppx/command_line_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ std::optional<CommandLineParser::ParsingError> CommandLineParser::Parse(int argc
std::vector<std::string> configJsonPaths;
configJsonPaths = mOpts.GetOptionValueOrDefault("config-json-path", configJsonPaths);
for (const auto& jsonPath : configJsonPaths) {
std::ifstream f(jsonPath);
std::ifstream f(jsonPath);
if (f.fail()) {
return "Invalid --config-json-path: " + jsonPath;
}
nlohmann::json data = nlohmann::json::parse(f);
if (auto error = AddJsonOptions(data)) {
return error;
Expand Down

0 comments on commit 5ff18a9

Please sign in to comment.