Avatar
Vapor3が依存するSwiftNIOも。 @swift-4.1.3 import NIO struct E: Error {} let eventLoop = EmbeddedEventLoop() let promises: [EventLoopPromise<Void>] = (0..<100).map { (_: Int) in eventLoop.newPromise() } let futures = promises.map { $0.futureResult } let fN: EventLoopFuture<Void> = EventLoopFuture<Void>.andAll(futures, eventLoop: eventLoop) _ = promises.map { $0.fail(error: E()) } do { () = try fN.wait() print("should've thrown an error") } catch _ as E { print("good") } catch let e { print("error of wrong type \(e)") }