modelix / modelix/modelix.core

Throw a specialized Exception for Mandatory elements

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
16
Forks
10
Avg merge
3h 9m
Merged PRs (30d)
26

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with metamodel-runtime/src/commonMain/kotlin/org/modelix/metamodel/ReferenceAccessor.kt at the MandatoryReferenceAccessor failure, then inspect ChildAccessor.kt at the referenced line for similar behavior. Trace how these exceptions are propagated to clients and define the dedicated exception coverage needed so callers can distinguish missing mandatory references from generic runtime failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.