Skip to content

Commit

Permalink
Merge pull request #90 from moosetechnology/89-improve-error-reportin…
Browse files Browse the repository at this point in the history
…g-when-there-is-an-issue-with-fame-slots

Catching the SlotNotFound error and added a comment to help users debug
  • Loading branch information
NicolasAnquetil authored Jan 4, 2025
2 parents d4ec297 + 44db1ca commit 8f0218e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Fame-Core/FMRelationSlot.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@ FMRelationSlot >> addAssociationFrom: ownerObject to: otherObject [
association may have to be removed first."

| realInverseSlot |
realInverseSlot := self realInverseSlotFor: otherObject.

[
realInverseSlot := self realInverseSlotFor: otherObject
] on: SlotNotFound
do: [ :err |
"The reverse slot was not found.
To investigate the problem, inspect:
- ownerObject -- The object which relation is set
- otherObject == The object which is set in the relation
- `self name` -- The name of the relation in ownerObject that is set to otherObject
- `self targetClass` -- The expected type for otherObject"
self halt.
].

realInverseSlot isToOne
ifTrue: [ (realInverseSlot read: otherObject) ifNotNil: [ :oldObject | realInverseSlot removeAssociationFrom: otherObject to: oldObject ].
Expand Down

0 comments on commit 8f0218e

Please sign in to comment.