Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit e60a53c

Browse files
fix: skip unexpect deleted model when list model (#1420)
* fix: skip unexpect deleted model when list model * fix: comment
1 parent d3e886b commit e60a53c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

engine/commands/model_list_cmd.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,19 @@ void ModelListCmd::Exec() {
2929
for (const auto& model_entry : list_entry.value()) {
3030
// auto model_entry = modellist_handler.GetModelInfo(model_handle);
3131
try {
32+
try {
33+
yaml_handler.ModelConfigFromFile(
34+
fmu::ToAbsoluteCortexDataPath(
35+
fs::path(model_entry.path_to_model_yaml))
36+
.string());
37+
} catch (const std::exception& e) {
38+
CTL_WRN("Fail to get model '" + model_entry.model +
39+
"' information: " + std::string(e.what()));
40+
yaml_handler.Reset();
41+
continue;
42+
}
43+
3244
count += 1;
33-
yaml_handler.ModelConfigFromFile(
34-
fmu::ToAbsoluteCortexDataPath(
35-
fs::path(model_entry.path_to_model_yaml))
36-
.string());
3745
auto model_config = yaml_handler.GetModelConfig();
3846
table.add_row({std::to_string(count), model_entry.model,
3947
model_entry.model_alias, model_config.engine,

0 commit comments

Comments
 (0)