Skip to content

Commit

Permalink
Catching the SlotNotFound error and added a comment to help users debug
Browse files Browse the repository at this point in the history
  • Loading branch information
anquetil committed Jan 4, 2025
1 parent d4ec297 commit 44db1ca
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 44db1ca

Please sign in to comment.