juxt / yada

A powerful Clojure web library, full HTTP, full async - see https://juxt.pro/yada/index.html
MIT License
735 stars 98 forks source link

Multipart request parsing exception #212

Open akiroz opened 6 years ago

akiroz commented 6 years ago

Exception will be thrown during multipart request parsing if schema coercion fails.

                    java.lang.Thread.run    Thread.java: 748
                                     ...
manifold.executor/thread-factory/reify/f   executor.clj:  44
io.aleph.dirigiste.Executor$Worker$1.run  Executor.java:  62
                                     ...
        manifold.deferred.Deferred/fn/fn   deferred.clj: 395
    manifold.deferred.Listener/onSuccess   deferred.clj: 219
manifold.deferred/eval16401/subscribe/fn   deferred.clj: 810
      manifold.deferred/eval16401/chain-   deferred.clj: 840
          yada.multipart/eval31183/fn/fn  multipart.clj: 664
                                     ...
                      clojure.core/assoc       core.clj: 190
                      clojure.core/assoc       core.clj: 193
                                     ...
java.lang.ClassCastException: manifold.deferred.ErrorDeferred cannot be cast to clojure.lang.Associative

yada.multipart/assoc-body-parameters returns either a ctx map or a manifold error-deferred https://github.com/juxt/yada/blob/9fdfcbbda81db81f7ea97b36b7aa3746fdb35775/ext/multipart/src/yada/multipart.clj#L603

but the error was never handled here: https://github.com/juxt/yada/blob/9fdfcbbda81db81f7ea97b36b7aa3746fdb35775/ext/multipart/src/yada/multipart.clj#L664

borkdude commented 6 years ago

It seems Schema coercion isn't supported for multipart requests anyway, but this should probably be documented somewhere?

titonbarua commented 6 years ago

Any follow up on this?