0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 00:10:11 -05:00

Properly report malformed json error

This commit is contained in:
Andrey Antukh 2022-11-08 11:26:58 +01:00 committed by Andrés Moya
parent 38ed3b076a
commit 59ba87d9cd

View file

@ -19,6 +19,7 @@
[yetti.request :as yrq]
[yetti.response :as yrs])
(:import
com.fasterxml.jackson.core.JsonParseException
com.fasterxml.jackson.core.io.JsonEOFException
io.undertow.server.RequestTooBigException
java.io.OutputStream))
@ -60,10 +61,13 @@
:code :request-body-too-large
:hint (ex-message cause)))
(instance? JsonEOFException cause)
(or (instance? JsonEOFException cause)
(instance? JsonParseException cause))
(raise (ex/error :type :validation
:code :malformed-json
:hint (ex-message cause)))
:hint (ex-message cause)
:cause cause))
:else
(raise cause)))]