           (lambda (location)
             (when location
               (if (assoc-default 'exception location)
-                  (ycmd--handle-goto-exception location)
+                  (ycmd--handle-exception location #'ycmd--handle-goto-exception)
                 (ycmd--handle-goto-success location)))))))))
 
 (defun ycmd--goto-location (location)

  (interactive)
  (ycmd--conditional-parse))

(defun ycmd--handle-notify-exception (ex)
  "Handle a notify exception.

If EX is an exception of type `UnknownExtraConf', handle
configuration file according the value of
`ycmd-extra-conf-handler'."
  (when (string-equal (assoc-default 'TYPE ex) "UnknownExtraConf")
    (deferred:$
      (let ((conf-file (assoc-default 'extra_conf_file ex)))
        (cond ((not conf-file)
               (warn "No extra_conf_file included in UnknownExtraConf exception. Consider reporting this."))

              ((or (eq ycmd-extra-conf-handler 'load)
                   (and (eq ycmd-extra-conf-handler 'ask)
                        (y-or-n-p (format "Load YCMD extra conf %s?" conf-file))))
               (ycmd--request "/load_extra_conf_file"
                              `((filepath . ,conf-file))))

              (t
               (ycmd--request "/ignore_extra_conf_file"
                                `((filepath . ,conf-file))))))
      (ycmd-notify-file-ready-to-parse))))

(defun ycmd--handle-notify-response (results)
  "If RESULTS is a vector, the response is an acual parse result.
Otherwise the response is probably an exception."
  (if (vectorp results)
      (run-hook-with-args 'ycmd-file-parse-result-hook results)
    (--if-let (assoc-default 'exception results)
        (ycmd--handle-notify-exception it))))

(defun ycmd-notify-file-ready-to-parse ()
  "Send a notification to ycmd that the buffer is ready to be parsed.

  (interactive)
  (ycmd--goto "GoToImprecise"))

(defun ycmd--handle-goto-exception (results)
  (let ((msg (assoc-default 'message results nil "UNKNOWN")))
    (warn (format "goto exception: %s" msg))))

(defun ycmd--handle-goto-success (location)
