mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 00:10:11 -05: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/catch on-error))))))
|
||||
|
||||
|
||||
;; --- EVENT: clone-template
|
||||
|
||||
(defn clone-template
|
||||
[{:keys [template-id project-id] :as params}]
|
||||
(dm/assert! (uuid? project-id))
|
||||
|
|
|
@ -50,6 +50,13 @@
|
|||
(finally
|
||||
(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
|
||||
"A general purpose error handler."
|
||||
[error]
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
[app.main.data.events :as ev]
|
||||
[app.main.data.messages :as msg]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.errors :as errors]
|
||||
[app.main.features :as features]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.file-uploader :refer [file-uploader]]
|
||||
|
@ -296,10 +297,10 @@
|
|||
(st/emit! (dd/fetch-recent-files)))
|
||||
|
||||
on-template-cloned-error
|
||||
(fn []
|
||||
(st/emit!
|
||||
(modal/hide)
|
||||
(msg/error (tr "dashboard.libraries-and-templates.import-error"))))
|
||||
(fn [cause]
|
||||
(errors/print-cause! "Template Clone Error" cause)
|
||||
(st/emit! (modal/hide)
|
||||
(msg/error (tr "dashboard.libraries-and-templates.import-error"))))
|
||||
|
||||
continue-files
|
||||
(fn []
|
||||
|
@ -314,7 +315,8 @@
|
|||
|
||||
continue-template
|
||||
(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)}]
|
||||
(swap! state
|
||||
(fn [state]
|
||||
|
|
Loading…
Reference in a new issue