xtool.git
Publicgit clone https://git.maproj.org/xtool.gitxtool.git / Sources / XKit / Utilities / RequestGrouper.swift
RequestGrouper.swift22 lines · 427 BRaw
| 1 | // |
| 2 | // RequestGrouper.swift |
| 3 | // XKit |
| 4 | // |
| 5 | // Created by Kabir Oberai on 14/10/19. |
| 6 | // Copyright © 2019 Kabir Oberai. All rights reserved. |
| 7 | // |
| 8 | |
| 9 | import Foundation |
| 10 | |
| 11 | public struct ErrorList<E: Error>: LocalizedError { |
| 12 | |
| 13 | public let errors: [E] |
| 14 | public init(_ errors: [E]) { |
| 15 | self.errors = errors |
| 16 | } |
| 17 | |
| 18 | public var errorDescription: String? { |
| 19 | errors.map { $0.localizedDescription }.localizedJoined() |
| 20 | } |
| 21 | |
| 22 | } |