enhance: display error message when write failed

pull/1672/head
Tienson Qin 2021-04-16 00:14:04 +08:00
parent cae6553a73
commit 700ff65c46
1 changed files with 7 additions and 1 deletions

View File

@ -5,7 +5,9 @@
[frontend.modules.file.core :as file]
[lambdaisland.glogi :as log]
[clojure.core.async :as async]
[frontend.util :as util]))
[frontend.util :as util]
[frontend.handler.notification :as notification]
[goog.object :as gobj]))
(def write-chan (async/chan))
@ -25,6 +27,10 @@
(doseq [page pages]
(try (do-write-file! page)
(catch js/Error e
(notification/show!
"Write file failed, please copy the changes to other editors in case of losing data."
[:div "Error: " (str (gobj/get e "stack"))]
:error)
(log/error :file/write-file-error {:error e})))))
(defn sync-to-file