shouldFinishProcessingLoad Behavior flow - Minor changes

This commit is contained in:
Sumanth Nadigadda 2023-02-23 20:54:35 +05:30
parent 29c73f2ccc
commit d647dc9d18
2 changed files with 3 additions and 5 deletions

View File

@ -148,12 +148,10 @@ import MVMCore
///Check with behavior if it can continue
do{
let conditionSatisfied = try executeThrowingBehaviors {(behavior: PageMoleculeTransformationBehavior) in
let allFinishedProcessingLoad = try executeThrowingBehaviors {(behavior: PageMoleculeTransformationBehavior) in
return try behavior.shouldFinishProcessingLoad(loadObject)
}
if conditionSatisfied == false {
return conditionSatisfied
}
guard allFinishedProcessingLoad else { return false }
} catch let behaviorError {
if let errorObject = MVMCoreErrorObject.createErrorObject(for: behaviorError, location: MVMCoreLoadHandler.sharedGlobal()?.errorLocation(forRequest: loadObject)) {
error.pointee = errorObject

View File

@ -46,6 +46,6 @@ public extension PageBehaviorHandlerProtocol {
}
func executeThrowingBehaviors<T>(_ behaviourBlock: (_ behavior: T) throws -> Bool) throws -> Bool {
return try behaviors?.compactMap({$0 as? T}).allSatisfy({ return try behaviourBlock($0) }) ?? false
return try behaviors?.compactMap({$0 as? T}).allSatisfy({ return try behaviourBlock($0) }) ?? true
}
}