mirror of
https://github.com/penpot/penpot.git
synced 2025-05-09 13:36:39 +02:00
✨ Properly report malformed json error
This commit is contained in:
parent
38ed3b076a
commit
59ba87d9cd
1 changed files with 6 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue