 import Foundation
 
-public enum FeedParserError: Error {
+public enum FeedParserError: Error, Equatable {
     case noFeed
     case noData
     case noFeedParsed
+    case parseError
 
     var localizedDescription: String {
         switch (self) {

            return "Must be configured with data"
        case .noFeedParsed:
            return "Could not parse a feed"
        }
    }
}

public final class FeedParser: Operation, XMLParserDelegate {
    public var completion : (Feed) -> Void = {_ in }
    public var onFailure : (Error) -> Void = {_ in }

    private var content : Data? = nil
    private var contentString : String? = nil


    public func parser(_ parser: XMLParser, parseErrorOccurred parseError: Error) {
        self.parser = nil
        self.onFailure(.parseError)
    }

    private var feed : Feed? = nil
