File tree Expand file tree Collapse file tree
Sources/CoreDataRepository/Internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ final class AggregateSubscription<Value: Numeric & Sendable>: Subscription<Value
4040 }
4141
4242 @usableFromInline
43- // swiftlint:disable:next function_body_length
4443 convenience init (
4544 function: CoreDataRepository . AggregateFunction ,
4645 context: NSManagedObjectContext ,
@@ -132,7 +131,20 @@ final class AggregateSubscription<Value: Numeric & Sendable>: Subscription<Value
132131 context: context,
133132 continuation: continuation
134133 )
135- fail ( . propertyDoesNotMatchEntity)
134+ guard let entityName = entityDesc. name ?? entityDesc. managedObjectClassName else {
135+ fail ( . propertyDoesNotMatchEntity( description: nil ) )
136+ return
137+ }
138+ guard let attributeEntityName = attributeDesc. entity. name ?? attributeDesc. entity. managedObjectClassName
139+ else {
140+ fail ( . propertyDoesNotMatchEntity( description: entityName) )
141+ return
142+ }
143+ fail (
144+ . propertyDoesNotMatchEntity(
145+ description: " \( entityName) != \( attributeDesc. name) . \( attributeEntityName) "
146+ )
147+ )
136148 return
137149 }
138150 self . init (
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ final class AggregateThrowingSubscription<Value: Numeric & Sendable>: ThrowingSu
4444 }
4545
4646 @usableFromInline
47- // swiftlint:disable:next function_body_length
4847 convenience init (
4948 function: CoreDataRepository . AggregateFunction ,
5049 context: NSManagedObjectContext ,
@@ -136,7 +135,20 @@ final class AggregateThrowingSubscription<Value: Numeric & Sendable>: ThrowingSu
136135 context: context,
137136 continuation: continuation
138137 )
139- fail ( . propertyDoesNotMatchEntity)
138+ guard let entityName = entityDesc. name ?? entityDesc. managedObjectClassName else {
139+ fail ( . propertyDoesNotMatchEntity( description: nil ) )
140+ return
141+ }
142+ guard let attributeEntityName = attributeDesc. entity. name ?? attributeDesc. entity. managedObjectClassName
143+ else {
144+ fail ( . propertyDoesNotMatchEntity( description: entityName) )
145+ return
146+ }
147+ fail (
148+ . propertyDoesNotMatchEntity(
149+ description: " \( entityName) != \( attributeDesc. name) . \( attributeEntityName) "
150+ )
151+ )
140152 return
141153 }
142154 self . init (
You can’t perform that action at this time.
0 commit comments