mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
✨ Properly report malformed json error
This commit is contained in:
parent
38ed3b076a
commit
59ba87d9cd
@ -19,6 +19,7 @@
|
|||||||
[yetti.request :as yrq]
|
[yetti.request :as yrq]
|
||||||
[yetti.response :as yrs])
|
[yetti.response :as yrs])
|
||||||
(:import
|
(:import
|
||||||
|
com.fasterxml.jackson.core.JsonParseException
|
||||||
com.fasterxml.jackson.core.io.JsonEOFException
|
com.fasterxml.jackson.core.io.JsonEOFException
|
||||||
io.undertow.server.RequestTooBigException
|
io.undertow.server.RequestTooBigException
|
||||||
java.io.OutputStream))
|
java.io.OutputStream))
|
||||||
@ -60,10 +61,13 @@
|
|||||||
:code :request-body-too-large
|
:code :request-body-too-large
|
||||||
:hint (ex-message cause)))
|
:hint (ex-message cause)))
|
||||||
|
|
||||||
(instance? JsonEOFException cause)
|
|
||||||
|
(or (instance? JsonEOFException cause)
|
||||||
|
(instance? JsonParseException cause))
|
||||||
(raise (ex/error :type :validation
|
(raise (ex/error :type :validation
|
||||||
:code :malformed-json
|
:code :malformed-json
|
||||||
:hint (ex-message cause)))
|
:hint (ex-message cause)
|
||||||
|
:cause cause))
|
||||||
:else
|
:else
|
||||||
(raise cause)))]
|
(raise cause)))]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user