                     (with-current-buffer (find-file-noselect (expand-file-name (cdr (assq 'name file)) tern-project-dir))
                       (setf tern-buffer-is-dirty nil))))
                 (funcall f data))
-               ((not (eq mode :silent)) (tern-message "Request failed: %s" (cdr err))))))
+               ((not (eq mode :silent)) (tern-message "Request failed: %s" err)))))
      doc)))
 
 (defun tern-send-buffer-to-server ()

;; Connection management

;;;###autoload
(defun tern-use-server (port)
  (interactive "nPort to connect to: ")
  (setf tern-known-port port))

;; Mode plumbing


(defvar tern-last-point-pos nil)

(defvar tern-known-port nil)
(defvar tern-server nil)
(defvar tern-explicit-port nil)
(defvar tern-project-dir nil)

(defvar tern-last-completions nil)
