Skip to content

Commit 6a880a4

Browse files
committed
Better format error message for missing file
- Also realized I don't really need to find some partial string matching solution. lower_bound() works just fine as at the lowest point in recursion, the type will always be returned on its own from getType();
1 parent f69a300 commit 6a880a4

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

src/LangFormat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void LangFormat::parseFormatByName(std::string name)
1010
std::ifstream formatFile(USER_FORMATS_PATH + name + ".json");
1111

1212
if (!formatFile.is_open()) {
13-
throw std::exception(fmt::format("\"{}\" is not a supported language or could not be found in {}\n", name, USER_FORMATS_PATH).c_str());
13+
throw std::exception(fmt::format("\"{}\" could not be found in {}\n", name, USER_FORMATS_PATH).c_str());
1414
}
1515

1616
//Read file contents into a string

src/LangFormat.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@ struct LangFormat
1919
std::string array_format;
2020
std::string structS_format; //Start of struct declaration
2121
std::string structE_format; //End of struct declaration
22-
2322
std::map<std::string, std::string> usings;
24-
2523
std::string file_extension;
2624

2725
LangFormat() = default;
28-
2926
void parseFormatByName(std::string name);
3027
};
3128

src/jsonConverters.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ std::string CodeGenerator::DeserializeJsonObject(rapidjson::Value* jsonValue, st
126126

127127
std::string typeString = getType(&member.value, nameOfMember, depth + 1);
128128

129-
//If type has a using, add it to an array, then remove it from the map
129+
//If type has a using, add it to an array for later, then remove it from the format map
130130
auto itr = format.usings.lower_bound(typeString);
131131
if (itr != format.usings.end()) {
132132
usings.push_back(itr->second);

0 commit comments

Comments
 (0)