From 700ff65c461938e907d7b989fecfb56aac20922f Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Fri, 16 Apr 2021 00:14:04 +0800 Subject: [PATCH] enhance: display error message when write failed --- src/main/frontend/modules/outliner/file.cljs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/frontend/modules/outliner/file.cljs b/src/main/frontend/modules/outliner/file.cljs index 723504711..118003598 100644 --- a/src/main/frontend/modules/outliner/file.cljs +++ b/src/main/frontend/modules/outliner/file.cljs @@ -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