remove unused CompositeError (#918)

Motivation:

CompositeError was completely unused, let's kill it.

Modifications:

remove CompositeError

Result:

fewer unused things
This commit is contained in:
Johannes Weiss authored and GitHub committed 2019-03-23 16:41:17 +00:00
1 parent e0f8275ce3
commit 93646f544c
4 files changed
-149

No files matched your search

-73
View File
@@ -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<Error>.Iterator {
return self.errors.makeIterator()
}
}
extension NIOCompositeError: RandomAccessCollection {
public typealias Element = Error
public typealias Index = Array<Error>.Index
public typealias Indices = Array<Error>.Indices
public typealias SubSequence = Array<Error>.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<Index>) -> 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
}
}
-1
View File
@@ -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),
@@ -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),
]
}
}
-41
View File
@@ -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)
}
}