             Ladybug.pendingRequests[request.id] = nil
             NSURLProtocol.removePropertyForKey(Constants.LadybugURLProperty, inRequest: req)
             
+            let res: Response
             if let httpResponse = response as? NSHTTPURLResponse {
-                let res = Response(status: httpResponse.statusCode, data: data, request: request)
-                
-                dispatch_async(dispatch_get_main_queue(), {
-                    request.done?(res)
-                    Ladybug.done?(res)
-                })
-            }
+                res = Response(status: httpResponse.statusCode, data: data, request: request, error: error)
+            } else {
+                res = Response(request: request, error: error)
+            }
+            
+            dispatch_async(dispatch_get_main_queue(), {
+                request.done?(res)
+                Ladybug.done?(res)
+            })
         })
         
         task.resume()

        return nil
    }
    
    init(status: Int, data: NSData?, request: Request) {
        self.status = status
        self.data = data
        self.request = request
    }
}


            var allow: Bool?
            
            if challenge.previousFailureCount > 0 {
                completionHandler(.RejectProtectionSpace, nil)
                return
            }
            
