mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 22:41:37 +02:00
✨ Add better error reporting on template clone operation
This commit is contained in:
parent
f1782f746d
commit
c022b71b59
3 changed files with 15 additions and 6 deletions
|
@ -920,8 +920,8 @@
|
||||||
(rx/tap on-success)
|
(rx/tap on-success)
|
||||||
(rx/catch on-error))))))
|
(rx/catch on-error))))))
|
||||||
|
|
||||||
|
|
||||||
;; --- EVENT: clone-template
|
;; --- EVENT: clone-template
|
||||||
|
|
||||||
(defn clone-template
|
(defn clone-template
|
||||||
[{:keys [template-id project-id] :as params}]
|
[{:keys [template-id project-id] :as params}]
|
||||||
(dm/assert! (uuid? project-id))
|
(dm/assert! (uuid? project-id))
|
||||||
|
|
|
@ -50,6 +50,13 @@
|
||||||
(finally
|
(finally
|
||||||
(js/console.groupEnd message))))
|
(js/console.groupEnd message))))
|
||||||
|
|
||||||
|
(defn print-cause!
|
||||||
|
[message cause]
|
||||||
|
(print-group! message (fn []
|
||||||
|
(print-data! cause)
|
||||||
|
(print-explain! cause)
|
||||||
|
(print-trace! cause))))
|
||||||
|
|
||||||
(defn on-error
|
(defn on-error
|
||||||
"A general purpose error handler."
|
"A general purpose error handler."
|
||||||
[error]
|
[error]
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
[app.main.data.events :as ev]
|
[app.main.data.events :as ev]
|
||||||
[app.main.data.messages :as msg]
|
[app.main.data.messages :as msg]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
|
[app.main.errors :as errors]
|
||||||
[app.main.features :as features]
|
[app.main.features :as features]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.file-uploader :refer [file-uploader]]
|
[app.main.ui.components.file-uploader :refer [file-uploader]]
|
||||||
|
@ -296,10 +297,10 @@
|
||||||
(st/emit! (dd/fetch-recent-files)))
|
(st/emit! (dd/fetch-recent-files)))
|
||||||
|
|
||||||
on-template-cloned-error
|
on-template-cloned-error
|
||||||
(fn []
|
(fn [cause]
|
||||||
(st/emit!
|
(errors/print-cause! "Template Clone Error" cause)
|
||||||
(modal/hide)
|
(st/emit! (modal/hide)
|
||||||
(msg/error (tr "dashboard.libraries-and-templates.import-error"))))
|
(msg/error (tr "dashboard.libraries-and-templates.import-error"))))
|
||||||
|
|
||||||
continue-files
|
continue-files
|
||||||
(fn []
|
(fn []
|
||||||
|
@ -314,7 +315,8 @@
|
||||||
|
|
||||||
continue-template
|
continue-template
|
||||||
(fn []
|
(fn []
|
||||||
(let [mdata {:on-success on-template-cloned-success :on-error on-template-cloned-error}
|
(let [mdata {:on-success on-template-cloned-success
|
||||||
|
:on-error on-template-cloned-error}
|
||||||
params {:project-id project-id :template-id (:id template)}]
|
params {:project-id project-id :template-id (:id template)}]
|
||||||
(swap! state
|
(swap! state
|
||||||
(fn [state]
|
(fn [state]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue