enhance: catch errors when app quits

pull/2777/head
Tienson Qin 2021-09-06 13:08:28 +08:00
parent 1ee0c240c3
commit b96332122f
4 changed files with 5 additions and 16 deletions

View File

@ -244,7 +244,10 @@
(.focus win))))
(.on app "window-all-closed" (fn []
(search/close!)
(try
(search/close!)
(catch js/Error _e
nil))
(.quit app)))
(.on app "ready"
(fn []

View File

@ -73,7 +73,7 @@
[]
(-> (run-git! #js ["add" "./*"])
(p/catch (fn [error]
(if (string/includes? "permission denied error: unable to index file")
(if (string/includes? error "permission denied error: unable to index file")
(js/console.error error)
(p/rejected error))))))

View File

@ -75,14 +75,6 @@
:on-click (fn []
(state/set-modal! (encryption/encryption-dialog url)))}
"🔐"])
[:a.control.ml-4 {:title (if local?
"Sync with the local directory"
"Clone again and re-index the db")
:on-click (fn []
(repo-handler/re-index!
nfs-handler/rebuild-index!
page-handler/create-today-journal!))}
"Re-index"]
[:a.text-gray-400.ml-4 {:title "No worries, unlink this graph will clear its cache only, it does not remove your files on the disk."
:on-click (fn []
(repo-handler/remove-repo! repo))}

View File

@ -301,12 +301,6 @@
{:desc "Rebuild search index"
:binding "mod+c mod+s"
:fn search-handler/rebuild-indices!}
:graph/re-index
{:desc "Re-index the whole graph"
:binding "mod+c mod+r"
:fn #(repo-handler/re-index!
nfs-handler/rebuild-index!
page-handler/create-today-journal!)}
:sidebar/open-today-page
{:desc "Open today's page in the right sidebar"
:binding (if mac? "mod+shift+j" "alt+shift+j")