diff --git a/Sources/NIO/CompositeError.swift b/Sources/NIO/CompositeError.swift deleted file mode 100644 index 13cd53000..000000000 --- a/Sources/NIO/CompositeError.swift +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the SwiftNIO open source project -// -// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of SwiftNIO project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -/// An `Error` that represents multiple errors that occurred during an operation. -/// -/// Because SwiftNIO frequently does multiple jobs at once, it is possible some operations out -/// of a set of operations may fail. This is most noticeable with `Channel.flush` on the -/// `DatagramChannel`, where some, but not all, of the datagram writes may fail. In this case -/// the `flush` should accurately represent that set of possibilities. The `NIOCompositeError` -/// is an attempt to do so. -public struct NIOCompositeError: Error { - private let errors: [Error] - - public init(comprising errors: [Error]) { - self.errors = errors - } -} - -extension NIOCompositeError: Sequence { - public func makeIterator() -> Array.Iterator { - return self.errors.makeIterator() - } -} - -extension NIOCompositeError: RandomAccessCollection { - public typealias Element = Error - public typealias Index = Array.Index - public typealias Indices = Array.Indices - public typealias SubSequence = Array.SubSequence - - public var endIndex: Index { - return self.errors.endIndex - } - - public var startIndex: Index { - return self.errors.startIndex - } - - public var indices: Indices { - return self.errors.indices - } - - public subscript(position: Index) -> Element { - return self.errors[position] - } - - public subscript(bounds: Range) -> SubSequence { - return self.errors[bounds] - } -} - -extension NIOCompositeError: CustomStringConvertible { - public var description: String { - return "NIOCompositeError\(String(describing: self.errors))" - } -} - -extension NIOCompositeError: CustomDebugStringConvertible { - public var debugDescription: String { - return self.description - } -} diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index 4be017a9c..5e23a573a 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -45,7 +45,6 @@ import XCTest testCase(ChannelPipelineTest.allTests), testCase(ChannelTests.allTests), testCase(CircularBufferTests.allTests), - testCase(CompositeErrorTests.allTests), testCase(CustomChannelTests.allTests), testCase(DatagramChannelTests.allTests), testCase(EchoServerClientTest.allTests), diff --git a/Tests/NIOTests/CompositeErrorTests+XCTest.swift b/Tests/NIOTests/CompositeErrorTests+XCTest.swift deleted file mode 100644 index b6241ad9b..000000000 --- a/Tests/NIOTests/CompositeErrorTests+XCTest.swift +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the SwiftNIO open source project -// -// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of SwiftNIO project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// -// -// CompositeErrorTests+XCTest.swift -// -import XCTest - -/// -/// NOTE: This file was generated by generate_linux_tests.rb -/// -/// Do NOT edit this file directly as it will be regenerated automatically when needed. -/// - -extension CompositeErrorTests { - - static var allTests : [(String, (CompositeErrorTests) -> () throws -> Void)] { - return [ - ("testEmptyCompositeError", testEmptyCompositeError), - ("testValuesInCompositeError", testValuesInCompositeError), - ] - } -} - diff --git a/Tests/NIOTests/CompositeErrorTests.swift b/Tests/NIOTests/CompositeErrorTests.swift deleted file mode 100644 index 3cdcd7158..000000000 --- a/Tests/NIOTests/CompositeErrorTests.swift +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the SwiftNIO open source project -// -// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of SwiftNIO project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -import NIO -import XCTest - -class CompositeErrorTests: XCTestCase { - func testEmptyCompositeError() { - let err = NIOCompositeError(comprising: []) - XCTAssertEqual(err.count, 0) - - for _ in err { - XCTFail("Should not iterate") - } - - XCTAssertNil(err.first) - XCTAssertNil(err.last) - } - - func testValuesInCompositeError() { - class MyError: Error { } - let innerErrors = [ChannelError.ioOnClosedChannel, ChannelError.alreadyClosed, ChannelError.connectPending] - let err = NIOCompositeError(comprising: innerErrors) - - XCTAssertEqual(err.count, 3) - - let retrievedErrors = Array(err) - XCTAssertEqual(retrievedErrors as! [ChannelError], innerErrors) - } -}