0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 16:30:37 -05:00

Minor improvements on error handling on frontend.

This commit is contained in:
Andrey Antukh 2021-01-22 15:23:21 +01:00 committed by Alonso Torres
parent 594bceff77
commit 4ee1f9cf2c
5 changed files with 20 additions and 18 deletions

View file

@ -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 ""})

View file

@ -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"
}

View file

@ -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]

View file

@ -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"))

View file

@ -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]))