| 239 | } |
| 240 | |
| 241 | bool 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 | |
| 280 | void cleanEPJSON(json &epjson) |
| 281 | { |
no test coverage detected