mirror of
https://github.com/penpot/penpot.git
synced 2025-07-12 23:17:16 +02:00
✨ Improve error report of invalid image
This commit is contained in:
parent
2a0031d23c
commit
81facd58c9
2 changed files with 6 additions and 3 deletions
|
@ -74,7 +74,7 @@
|
|||
::yrs/headers headers}))
|
||||
|
||||
(defmethod handle-exception :validation
|
||||
[err _]
|
||||
[err request]
|
||||
(let [{:keys [code] :as data} (ex-data err)]
|
||||
(cond
|
||||
(= code :spec-validation)
|
||||
|
@ -95,6 +95,11 @@
|
|||
(= code :request-body-too-large)
|
||||
{::yrs/status 413 ::yrs/body data}
|
||||
|
||||
(= code :invalid-image)
|
||||
(binding [l/*context* (request->context request)]
|
||||
(l/error :hint "unexpected error on processing image" :cause err)
|
||||
{::yrs/status 400 ::yrs/body data})
|
||||
|
||||
:else
|
||||
{::yrs/status 400 ::yrs/body data})))
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.logging :as l]
|
||||
[app.common.media :as cm]
|
||||
[app.common.schema :as sm]
|
||||
[app.common.schema.generators :as sg]
|
||||
|
@ -227,7 +226,6 @@
|
|||
|
||||
(defmethod process-error org.im4java.core.InfoException
|
||||
[error]
|
||||
(l/error :hint "unexpected error on processing image" :cause error)
|
||||
(ex/raise :type :validation
|
||||
:code :invalid-image
|
||||
:hint "invalid image"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue