mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -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
|
||||
[{:keys [session] :as cfg} request]
|
||||
(session/delete! cfg request)
|
||||
{:status 200
|
||||
{:status 204
|
||||
:cookies (session/cookies session {:value "" :max-age -1})
|
||||
:body ""})
|
||||
|
|
|
@ -1496,6 +1496,18 @@
|
|||
"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" : {
|
||||
"used-in" : [ "src/app/main/ui/settings/options.cljs:54" ],
|
||||
"translations" : {
|
||||
|
@ -1652,7 +1664,7 @@
|
|||
}
|
||||
},
|
||||
"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" : {
|
||||
"en" : "Retry"
|
||||
}
|
||||
|
|
|
@ -131,8 +131,6 @@
|
|||
|
||||
(defn assign-exception
|
||||
[{:keys [type] :as error}]
|
||||
(us/assert (s/nilable map?) error)
|
||||
(us/assert (s/nilable ::us/keyword) type)
|
||||
(ptk/reify ::assign-exception
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
(mf/defc on-main-error
|
||||
[{:keys [error] :as props}]
|
||||
(let [data (ex-data error)]
|
||||
(ptk/handle-error error)
|
||||
(mf/use-effect #(ptk/handle-error error))
|
||||
[:span "Internal application errror"]))
|
||||
|
||||
(mf/defc main-page
|
||||
|
@ -285,22 +285,17 @@
|
|||
(ptk/handle-error (ex-data error))
|
||||
(do
|
||||
(ts/schedule
|
||||
(st/emitf (dm/show
|
||||
{:content "Something wrong has happened."
|
||||
:type :error
|
||||
:timeout 3000})))
|
||||
(st/emitf (dm/assign-exception error)))
|
||||
|
||||
(js/console.group "Internal error:")
|
||||
(js/console.log "hint:" (or (ex-message error)
|
||||
(:hint error)
|
||||
(:message error)))
|
||||
(ex/ignoring
|
||||
(js/console.error "repr: " (pr-str error))
|
||||
(js/console.error "data: " (clj->js error))
|
||||
(js/console.error (clj->js error))
|
||||
(js/console.error "stack:" (.-stack error)))
|
||||
(js/console.groupEnd "Internal error:"))))
|
||||
|
||||
|
||||
(defonce uncaught-error-handler
|
||||
(letfn [(on-error [event]
|
||||
(ptk/handle-error (unchecked-get event "error"))
|
||||
|
|
|
@ -88,8 +88,8 @@
|
|||
[:div.exception-content
|
||||
[:div.container
|
||||
[:div.image i/icon-empty]
|
||||
[:div.main-message "Internal Error"]
|
||||
[:div.desc-message "Something bad happended on backend servers. Please retry the operation and if the problem persists, contact with support."]
|
||||
[:div.main-message (tr "labels.internal-error.main-message")]
|
||||
[:div.desc-message (tr "labels.internal-error.desc-message")]
|
||||
[:div.sign-info
|
||||
[:a.btn-primary.btn-small
|
||||
{:on-click (st/emitf (dm/assign-exception nil))}
|
||||
|
@ -107,8 +107,5 @@
|
|||
:service-unavailable
|
||||
[:& service-unavailable]
|
||||
|
||||
:server-error
|
||||
[:& internal-error]
|
||||
|
||||
nil))
|
||||
[:& internal-error]))
|
||||
|
||||
|
|
Loading…
Reference in a new issue