| 87 | } |
| 88 | |
| 89 | std::string cmJSONState::GetErrorMessage(bool showContext) |
| 90 | { |
| 91 | std::string message; |
| 92 | std::string filenameName = cmSystemTools::GetFilenameName(this->Filename); |
| 93 | for (auto const& error : this->errors) { |
| 94 | Location loc = error.GetLocation(); |
| 95 | if (!filenameName.empty() && loc.line > 0) { |
| 96 | message = cmStrCat(message, filenameName, ':', loc.line, ": "); |
| 97 | } |
| 98 | message = cmStrCat(message, error.GetErrorMessage(), '\n'); |
| 99 | if (showContext && loc.line > 0) { |
| 100 | message = cmStrCat(message, GetJsonContext(loc), '\n'); |
| 101 | } |
| 102 | } |
| 103 | message.pop_back(); |
| 104 | return message; |
| 105 | } |
| 106 | |
| 107 | std::string cmJSONState::key() |
| 108 | { |