mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 04:26:10 +02:00
✨ Add better error report on importing truncated binfile
This commit is contained in:
parent
afd68fa09d
commit
8ea82021f0
2 changed files with 7 additions and 3 deletions
|
@ -40,6 +40,7 @@
|
||||||
[promesa.util :as pu]
|
[promesa.util :as pu]
|
||||||
[yetti.adapter :as yt])
|
[yetti.adapter :as yt])
|
||||||
(:import
|
(:import
|
||||||
|
com.github.luben.zstd.ZstdIOException
|
||||||
com.github.luben.zstd.ZstdInputStream
|
com.github.luben.zstd.ZstdInputStream
|
||||||
com.github.luben.zstd.ZstdOutputStream
|
com.github.luben.zstd.ZstdOutputStream
|
||||||
java.io.DataInputStream
|
java.io.DataInputStream
|
||||||
|
@ -756,6 +757,12 @@
|
||||||
(pu/with-open [input (io/input-stream input)]
|
(pu/with-open [input (io/input-stream input)]
|
||||||
(read-import! (assoc cfg ::input input))))
|
(read-import! (assoc cfg ::input input))))
|
||||||
|
|
||||||
|
(catch ZstdIOException cause
|
||||||
|
(ex/raise :type :validation
|
||||||
|
:code :invalid-penpot-file
|
||||||
|
:hint "invalid penpot file received: probably truncated"
|
||||||
|
:cause cause))
|
||||||
|
|
||||||
(catch Throwable cause
|
(catch Throwable cause
|
||||||
(vreset! cs cause)
|
(vreset! cs cause)
|
||||||
(throw cause))
|
(throw cause))
|
||||||
|
|
|
@ -61,9 +61,6 @@
|
||||||
(let [result (handler)]
|
(let [result (handler)]
|
||||||
(events/tap :end result))
|
(events/tap :end result))
|
||||||
(catch Throwable cause
|
(catch Throwable cause
|
||||||
(binding [l/*context* (errors/request->context request)]
|
|
||||||
(l/err :hint "unexpected error process streaming response"
|
|
||||||
:cause cause))
|
|
||||||
(events/tap :error (errors/handle' cause request)))
|
(events/tap :error (errors/handle' cause request)))
|
||||||
(finally
|
(finally
|
||||||
(sp/close! events/*channel*)
|
(sp/close! events/*channel*)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue