mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 17:36:12 +02:00
🐛 Fix unexpected exception on upload invalid image.
This commit is contained in:
parent
76e43f339a
commit
9b875aba21
2 changed files with 11 additions and 3 deletions
|
@ -417,13 +417,16 @@
|
|||
(defn- handle-upload-error [on-error stream]
|
||||
(->> stream
|
||||
(rx/catch
|
||||
(fn on-error [error]
|
||||
(fn on-error* [error]
|
||||
(if (ex/ex-info? error)
|
||||
(on-error (ex-data error))
|
||||
(on-error* (ex-data error))
|
||||
(cond
|
||||
(= (:code error) :media-type-not-allowed)
|
||||
(rx/of (dm/error (tr "errors.media-type-not-allowed")))
|
||||
|
||||
(= (:code error) :invalid-image)
|
||||
(rx/of (dm/error (tr "errors.media-type-not-allowed")))
|
||||
|
||||
(= (:code error) :media-too-large)
|
||||
(rx/of (dm/error (tr "errors.media-too-large")))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue