             return "Must be configured with data"
         case .noFeedParsed:
             return "Could not parse a feed"
+        case .parseError:
+            return "Could not parse the feed"
         }
     }
 }
 
 public final class FeedParser: Operation, XMLParserDelegate {
     public var completion : (Feed) -> Void = {_ in }
-    public var onFailure : (Error) -> Void = {_ in }
+    public var onFailure : (FeedParserError) -> Void = {_ in }
 
     private var content : Data? = nil
     private var contentString : String? = nil

import Foundation

public enum FeedParserError: Error {
    case noFeed
    case noData
    case noFeedParsed

    var localizedDescription: String {
        switch (self) {


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

    private var feed : Feed? = nil
