Handle server unavailable error on auto-index schedule job in khoj.el

This commit is contained in:
Debanjum Singh Solanky
2023-11-24 16:39:44 -08:00
parent 5fac39afed
commit 0885fc6c23

View File

@@ -405,14 +405,14 @@ Auto invokes setup steps on calling main entrypoint."
;; render response from indexing API endpoint on server ;; render response from indexing API endpoint on server
(lambda (status) (lambda (status)
(if (not status) (if (not status)
(message "khoj.el: %scontent index %supdated" (if content-type (format "%s " content-type) "") (if force "force " "")) (message "khoj.el: %scontent index %supdated" (if content-type (format "%s " content-type) "all ") (if force "force " ""))
(with-current-buffer (current-buffer) (with-current-buffer (current-buffer)
(goto-char "\n\n") (search-forward "\n\n" nil t)
(message "khoj.el: Failed to %supdate %s content index. Status: %s. Response: %s" (message "khoj.el: Failed to %supdate %s content index. Status: %s%s"
(if force "force " "") (if force "force " "")
content-type (if content-type (format "%s " content-type) "all")
status (string-trim (format "%s %s" (nth 1 (nth 1 status)) (nth 2 (nth 1 status))))
(string-trim (buffer-substring-no-properties (point) (point-max))))))) (if (> (- (point-max) (point)) 0) (format ". Response: %s" (string-trim (buffer-substring-no-properties (point) (point-max)))) "")))))
nil t t))) nil t t)))
(setq khoj--indexed-files files-to-index))) (setq khoj--indexed-files files-to-index)))