                             `((filepath . ,conf-file))))))
     (ycmd--report-status 'unparsed)
     (ycmd-notify-file-ready-to-parse)))
+
+(defun ycmd--handle-error-exception (results)
+  "Handle exception and print message from RESULTS."
+  (let* ((msg (assoc-default 'message results))
+         (is-error (pcase msg
+                     ((or "Still no compile flags, no completions yet."
+                          "File is invalid."
+                          "No completions found; errors in the file?"
+                          (pred (string-prefix-p "Gocode binary not found."))
+                          "Gocode binary not found."
+                          "Gocode returned invalid JSON response."
+                          (pred (string-prefix-p "Gocode panicked")))
+                      t))))
+    (when is-error
+      (ycmd--report-status 'errored))
+    (message "%s" (concat (when is-error "ERROR: ")
+                          (if msg msg "Unknown exception.")))))
 
 (defun ycmd--handle-notify-response (results)
   "If RESULTS is a vector or nil, the response is an acual parse result.

     (-when-let (documentation (assoc-default 'detailed_info result))
       (with-help-window (get-buffer-create " *ycmd-documentation*")
         (with-current-buffer standard-output
           (insert documentation)))))
   (lambda (result)
     (-when-let* ((exception (assoc-default 'exception result))
                  (exception-type (assoc-default 'TYPE exception))
                  (msg (assoc-default 'message result)))
       (when (string= msg "No documentation available for current context")
         (message "%s" msg))))))

(define-button-type 'ycmd--error-button
  'face '(error bold underline)


(defun ycmd--goto (type)
  "Implementation of GoTo according to the request TYPE."
  (ycmd--send-request type 'ycmd--handle-goto-success))

(defun ycmd--goto-location (location)
  "Move cursor to LOCATION.
