ring-swagger & compojure-api
petr.mensik 2018-02-05T10:14:45.000233Z

I am wondering why the exception handling doesn't work correctly when it's thrown from a referenced library (JAR file). I have a route like this

(GET "/token" []
      :summary "Returns auth token"
      :current-user user
      (ok (ipex/get-token (:email user)))) ; throws exception
get-token looks like this
(try (:body (client/post (str (:url api-config) "/auth/token") (merge ipex-http-client-config
                                  {:form-params {:identityType "email"
                                                 :identityValue user-email}})))
       (catch Exception ex
         (ex-info "Problem connecting to the IPEX" {:cause :ipex-api} ex))))
When the exception is thrown, I can see following error in server log java.lang.IllegalArgumentException: No implementation of method: :write-body-to-stream of protocol: #'ring.core.protocols/StreamableResponseBody found for class: clojure.lang.ExceptionInfo Why its not handled via exception handlers in my api-config? It works for all other exceptions except this one particular case (I am hanndling exceptions with ex/default exception-handler)


@petr.mensik I think you need to throw the exception as well — ex-info only creates the exception, but doesn’t throw it.

petr.mensik 2018-02-05T10:54:45.000389Z

@karl omg I am so stupid 🙂 You are right of course