diff --git a/src/Bloc/BlAlreadyAddedAsChildError.class.st b/src/Bloc/BlAlreadyAddedAsChildError.class.st index f4c305367..1624ac9cb 100644 --- a/src/Bloc/BlAlreadyAddedAsChildError.class.st +++ b/src/Bloc/BlAlreadyAddedAsChildError.class.st @@ -8,7 +8,7 @@ Class { #instVars : [ 'element' ], - #category : 'Bloc-Basic-Errors' + #category : #'Bloc-Basic-Errors' } { #category : #'instance creation' } @@ -18,7 +18,7 @@ BlAlreadyAddedAsChildError class >> element: anElement [ { #category : #accessing } BlAlreadyAddedAsChildError >> description [ - ^ 'Can not add child that is already added to another element!' + ^ ('Can not add {1} because it is already added to another element.') format: { self element } ] { #category : #accessing } diff --git a/src/Bloc/BlElement.class.st b/src/Bloc/BlElement.class.st index 33aca2f02..b489bdd7e 100644 --- a/src/Bloc/BlElement.class.st +++ b/src/Bloc/BlElement.class.st @@ -253,9 +253,10 @@ BlElement >> addChildren: aListOfElements [ self assert: [ aListOfElements isNotNil ] description: [ 'List of elements to add must not be nil' ]. - self - assert: [ aListOfElements allSatisfy: [ :anElement | anElement parent isNil ] ] - description: [ 'All elements must not have parent' ]. + + aListOfElements do: [ :eachElement | + eachElement hasParent + ifTrue: [ (BlAlreadyAddedAsChildError element: eachElement) signal ] ]. "fast exit if there are no elements to add" aListOfElements