MCPcopy Create free account
hub / github.com/NatLabRockies/EnergyPlus / processErrors

Function processErrors

src/ConvertInputFormat/main.cpp:241–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241bool processErrors(std::unique_ptr<IdfParser> const &idf_parser, std::unique_ptr<Validation> const &validation, bool isDDY)
242{
243 auto const idf_parser_errors = idf_parser->errors();
244 auto const idf_parser_warnings = idf_parser->warnings();
245
246 auto const validation_errors = validation->errors();
247 bool hasValidationErrors = false;
248
249 auto const validation_warnings = validation->warnings();
250
251 for (auto const &error : idf_parser_errors) {
252 displayMessage(error);
253 }
254 for (auto const &warning : idf_parser_warnings) {
255 displayMessage(warning);
256 }
257 for (auto const &error : validation_errors) {
258 bool const missing_building = error.find("Missing required property 'Building'") != std::string::npos;
259 bool const missing_geometry = error.find("Missing required property 'GlobalGeometryRules'") != std::string::npos;
260 // if we encountered one of the expected missing building/geometry errors, we should handle them special
261 if (missing_building || missing_geometry) {
262 if (isDDY) { // for DDY files just ignore it completely
263 continue;
264 }
265 // for other IDFs, go ahead and emit a message, but don't trigger a failure
266 displayMessage(error);
267 continue;
268 }
269 // and if it wasn't a missing building or missing geometry error, we will emit that as a proper error and fail
270 hasValidationErrors = true;
271 displayMessage(error);
272 }
273 for (auto const &warning : validation_warnings) {
274 displayMessage(warning);
275 }
276
277 return hasValidationErrors || idf_parser->hasErrors();
278}
279
280void cleanEPJSON(json &epjson)
281{

Callers 2

processInputMethod · 0.85
processInputFunction · 0.85

Calls 2

displayMessageFunction · 0.85
hasErrorsMethod · 0.45

Tested by

no test coverage detected