mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 09:41:41 +02:00
✨ Add proper error reporting on debug.validare fn
This commit is contained in:
parent
f06be2727e
commit
973214ea50
3 changed files with 41 additions and 14 deletions
|
@ -7,6 +7,7 @@
|
|||
(ns app.main.errors
|
||||
"Generic error handling"
|
||||
(:require
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.pprint :as pp]
|
||||
[app.common.schema :as sm]
|
||||
[app.main.data.messages :as msg]
|
||||
|
@ -57,6 +58,22 @@
|
|||
(print-explain! cause)
|
||||
(print-trace! cause))))
|
||||
|
||||
(defn print-error!
|
||||
[cause]
|
||||
(cond
|
||||
(map? cause)
|
||||
(print-cause! (:hint cause "Unexpected Error") cause)
|
||||
|
||||
(ex/error? cause)
|
||||
(print-cause! (ex-message cause) (ex-data cause))
|
||||
|
||||
:else
|
||||
(let [trace (.-stack cause)]
|
||||
(print-cause! (ex-message cause)
|
||||
{:hint (ex-message cause)
|
||||
::trace trace
|
||||
::instance cause}))))
|
||||
|
||||
(defn on-error
|
||||
"A general purpose error handler."
|
||||
[error]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue