The MandatoryReferenceAccessor currently throws a RuntimeException when a mandatory reference is missing:
https://github.com/modelix/modelix.core/blob/main/metamodel-runtime/src/commonMain/kotlin/org/modelix/metamodel/ReferenceAccessor.kt#L27
When propagating changes to clients, catching RuntimeException is too generic. We should be more specific here, for example by throwing our own, e.g. MandatoryReferenceMissingException.
This is also applicable to other parts in the code, for example:
https://github.com/modelix/modelix.core/blob/main/metamodel-runtime/src/commonMain/kotlin/org/modelix/metamodel/ChildAccessor.kt#L24
The
MandatoryReferenceAccessorcurrently throws aRuntimeExceptionwhen a mandatory reference is missing:https://github.com/modelix/modelix.core/blob/main/metamodel-runtime/src/commonMain/kotlin/org/modelix/metamodel/ReferenceAccessor.kt#L27
When propagating changes to clients, catching RuntimeException is too generic. We should be more specific here, for example by throwing our own, e.g.
MandatoryReferenceMissingException.This is also applicable to other parts in the code, for example:
https://github.com/modelix/modelix.core/blob/main/metamodel-runtime/src/commonMain/kotlin/org/modelix/metamodel/ChildAccessor.kt#L24