   private func disconnectWithError(error: NSError?) {
     if status == .Disconnecting || status == .NotConnected {
       return
+    }
+    if let error = error {
+      Logger.warn("Socket error \(error)")
     }
     setStatus(.Disconnecting)
     connectionTimeoutTimer?.invalidate()

  // parsing was successful. For some message types (e.g. VersionAck), payloadData is expected to
  // have a length of 0.
  public func didParseMessage(message: Message) {
    // TODO: Add the rest of the messages.
    Logger.debug("Received \(message.header.command.rawValue) message")
    let payloadStream = NSInputStream(data: message.payload)
    payloadStream.open()

    precondition(status == .Connecting)
    precondition(self.peerVersion != nil)
    precondition(receivedVersionAck)
    Logger.info("Connected to peer \(peerHostname!):\(peerPort)")
    connectionTimeoutTimer?.invalidate()
    connectionTimeoutTimer = nil
    setStatus(.Connected)
