Skip to content

Commit 0a558b7

Browse files
committed
fix(mps-sync-plugin): handle exception during initialization of NodeAssociationToModelServer
1 parent 0313c0a commit 0a558b7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bulk-model-sync-lib/src/commonMain/kotlin/org/modelix/model/sync/bulk/NodeAssociationToModelServer.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,22 @@ import org.modelix.model.api.getRootNode
1313
import org.modelix.model.area.PArea
1414
import org.modelix.model.data.NodeData
1515

16+
private val LOG = mu.KotlinLogging.logger { }
17+
1618
class NodeAssociationToModelServer(val branch: IBranch) : INodeAssociation {
1719

1820
private val associations: MutableMap<String, IWritableNode> by lazy {
1921
val map = HashMap<String, IWritableNode>()
20-
for (node in branch.getRootNode().getDescendants(true).map { it.asWritableNode() }) {
21-
map[node.getPropertyValue(NodeData.ID_PROPERTY_REF) ?: continue] = node
22+
try {
23+
for (node in branch.getRootNode().getDescendants(true).map { it.asWritableNode() }) {
24+
try {
25+
map[node.getPropertyValue(NodeData.ID_PROPERTY_REF) ?: continue] = node
26+
} catch (ex: Exception) {
27+
LOG.error(ex) { "Reading associations from $node failed" }
28+
}
29+
}
30+
} catch (ex: Exception) {
31+
LOG.error(ex) { "Reading associations from $branch failed" }
2232
}
2333
map
2434
}

0 commit comments

Comments
 (0)