mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
✨ Minor improvements on error handling on frontend.
This commit is contained in:
parent
594bceff77
commit
4ee1f9cf2c
5 changed files with 20 additions and 18 deletions
|
@ -26,6 +26,6 @@
|
||||||
(defn logout-handler
|
(defn logout-handler
|
||||||
[{:keys [session] :as cfg} request]
|
[{:keys [session] :as cfg} request]
|
||||||
(session/delete! cfg request)
|
(session/delete! cfg request)
|
||||||
{:status 200
|
{:status 204
|
||||||
:cookies (session/cookies session {:value "" :max-age -1})
|
:cookies (session/cookies session {:value "" :max-age -1})
|
||||||
:body ""})
|
:body ""})
|
||||||
|
|
|
@ -1496,6 +1496,18 @@
|
||||||
"es" : "Ocultar comentarios resueltos"
|
"es" : "Ocultar comentarios resueltos"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"labels.internal-error.desc-message" : {
|
||||||
|
"used-in" : [ "src/app/main/ui/static.cljs:92" ],
|
||||||
|
"translations" : {
|
||||||
|
"en" : "Something bad happended. Please retry the operation and if the problem persists, contact with support."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"labels.internal-error.main-message" : {
|
||||||
|
"used-in" : [ "src/app/main/ui/static.cljs:91" ],
|
||||||
|
"translations" : {
|
||||||
|
"en" : "Internal Error"
|
||||||
|
}
|
||||||
|
},
|
||||||
"labels.language" : {
|
"labels.language" : {
|
||||||
"used-in" : [ "src/app/main/ui/settings/options.cljs:54" ],
|
"used-in" : [ "src/app/main/ui/settings/options.cljs:54" ],
|
||||||
"translations" : {
|
"translations" : {
|
||||||
|
@ -1652,7 +1664,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labels.retry" : {
|
"labels.retry" : {
|
||||||
"used-in" : [ "src/app/main/ui/static.cljs:62", "src/app/main/ui/static.cljs:79" ],
|
"used-in" : [ "src/app/main/ui/static.cljs:62", "src/app/main/ui/static.cljs:79", "src/app/main/ui/static.cljs:96" ],
|
||||||
"translations" : {
|
"translations" : {
|
||||||
"en" : "Retry"
|
"en" : "Retry"
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,8 +131,6 @@
|
||||||
|
|
||||||
(defn assign-exception
|
(defn assign-exception
|
||||||
[{:keys [type] :as error}]
|
[{:keys [type] :as error}]
|
||||||
(us/assert (s/nilable map?) error)
|
|
||||||
(us/assert (s/nilable ::us/keyword) type)
|
|
||||||
(ptk/reify ::assign-exception
|
(ptk/reify ::assign-exception
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
(mf/defc on-main-error
|
(mf/defc on-main-error
|
||||||
[{:keys [error] :as props}]
|
[{:keys [error] :as props}]
|
||||||
(let [data (ex-data error)]
|
(let [data (ex-data error)]
|
||||||
(ptk/handle-error error)
|
(mf/use-effect #(ptk/handle-error error))
|
||||||
[:span "Internal application errror"]))
|
[:span "Internal application errror"]))
|
||||||
|
|
||||||
(mf/defc main-page
|
(mf/defc main-page
|
||||||
|
@ -285,22 +285,17 @@
|
||||||
(ptk/handle-error (ex-data error))
|
(ptk/handle-error (ex-data error))
|
||||||
(do
|
(do
|
||||||
(ts/schedule
|
(ts/schedule
|
||||||
(st/emitf (dm/show
|
(st/emitf (dm/assign-exception error)))
|
||||||
{:content "Something wrong has happened."
|
|
||||||
:type :error
|
|
||||||
:timeout 3000})))
|
|
||||||
|
|
||||||
(js/console.group "Internal error:")
|
(js/console.group "Internal error:")
|
||||||
(js/console.log "hint:" (or (ex-message error)
|
(js/console.log "hint:" (or (ex-message error)
|
||||||
(:hint error)
|
(:hint error)
|
||||||
(:message error)))
|
(:message error)))
|
||||||
(ex/ignoring
|
(ex/ignoring
|
||||||
(js/console.error "repr: " (pr-str error))
|
(js/console.error (clj->js error))
|
||||||
(js/console.error "data: " (clj->js error))
|
|
||||||
(js/console.error "stack:" (.-stack error)))
|
(js/console.error "stack:" (.-stack error)))
|
||||||
(js/console.groupEnd "Internal error:"))))
|
(js/console.groupEnd "Internal error:"))))
|
||||||
|
|
||||||
|
|
||||||
(defonce uncaught-error-handler
|
(defonce uncaught-error-handler
|
||||||
(letfn [(on-error [event]
|
(letfn [(on-error [event]
|
||||||
(ptk/handle-error (unchecked-get event "error"))
|
(ptk/handle-error (unchecked-get event "error"))
|
||||||
|
|
|
@ -88,8 +88,8 @@
|
||||||
[:div.exception-content
|
[:div.exception-content
|
||||||
[:div.container
|
[:div.container
|
||||||
[:div.image i/icon-empty]
|
[:div.image i/icon-empty]
|
||||||
[:div.main-message "Internal Error"]
|
[:div.main-message (tr "labels.internal-error.main-message")]
|
||||||
[:div.desc-message "Something bad happended on backend servers. Please retry the operation and if the problem persists, contact with support."]
|
[:div.desc-message (tr "labels.internal-error.desc-message")]
|
||||||
[:div.sign-info
|
[:div.sign-info
|
||||||
[:a.btn-primary.btn-small
|
[:a.btn-primary.btn-small
|
||||||
{:on-click (st/emitf (dm/assign-exception nil))}
|
{:on-click (st/emitf (dm/assign-exception nil))}
|
||||||
|
@ -107,8 +107,5 @@
|
||||||
:service-unavailable
|
:service-unavailable
|
||||||
[:& service-unavailable]
|
[:& service-unavailable]
|
||||||
|
|
||||||
:server-error
|
[:& internal-error]))
|
||||||
[:& internal-error]
|
|
||||||
|
|
||||||
nil))
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue