0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-04 13:29:14 -05:00

🐛 Fix unexpected exception on importing some binary files

This commit is contained in:
Andrey Antukh 2023-12-15 17:31:30 +01:00 committed by Andrés Moya
parent 60fc1a48a5
commit 15f81e557c
3 changed files with 9 additions and 10 deletions

View file

@ -81,6 +81,7 @@
(cond (cond
(or (= code :spec-validation) (or (= code :spec-validation)
(= code :params-validation) (= code :params-validation)
(= code :schema-validation)
(= code :data-validation)) (= code :data-validation))
(let [explain (ex/explain data)] (let [explain (ex/explain data)]
{::rres/status 400 {::rres/status 400

View file

@ -722,7 +722,8 @@
(-> fdata (-> fdata
(update :pages-index relink-shapes) (update :pages-index relink-shapes)
(update :components relink-shapes) (update :components relink-shapes)
(update :media relink-media)))))) (update :media relink-media)
(d/without-nils))))))
(defmethod read-section :v1/files (defmethod read-section :v1/files

View file

@ -726,16 +726,13 @@
(log/error :hint "unexpected error on import process" (log/error :hint "unexpected error on import process"
:project-id project-id :project-id project-id
::log/sync? true) ::log/sync? true)
(let [edata (if (map? cause) cause (ex-data cause))]
(when (map? cause)
(println "Error data:") (println "Error data:")
(pp/pprint (dissoc cause :explain) {:level 2 :length 10})) (pp/pprint (dissoc edata :explain) {:level 2 :length 10})
(when (string? (:explain cause)) (when (string? (:explain edata))
(js/console.log (:explain cause))) (js/console.log (:explain edata)))
(rx/of {:status :import-error (rx/of {:status :import-error
:file-id (:file-id data) :file-id (:file-id data)})))))))))))
:error (:hint cause)
:error-data cause}))))))))))