Fork me on GitHub
#yada
<
2017-12-02
>
borkdude13:12:28

@malcolmsparks btw, the new-classpath-resource needs this fix: https://github.com/juxt/yada/pull/209

borkdude13:12:20

@kardan What exactly do you want to accomplish?

kardan13:12:50

@borkdude essentially I tried to have a route structure [… [“assets/” class-path-hander] [true not-found-handler]]. A request with /no-match-url would end up in “my” not-found-handler. But a request to /assets/no-match-url would end up in Yada’s build in 404 page.

borkdude13:12:00

We have solved that problem. I can tell you the details later today, but I’m busy right now.

kardan13:12:26

No worries. I’m also busy, so no stress. I was thinking that he new-classpath-resource should return nil and not always a resource. But have not have time to investigate. So look forward to the fix 🙂

kardan13:12:44

Thanks for the message @borkdude

borkdude14:12:02

@kardan I looked into it, and we did it like this:

(defmethod render-error "text/html"
    [status ^Throwable error representation {:keys [id options] :as m}]
    (parser/render-file
     "error.html"
     {:status status
      :message (format "%d: %s" status (body/get-error-message status))
      :description (body/get-error-description status)
      :exception (when dev-env?
                   (let [baos (java.io.ByteArrayOutputStream.)
                         pw (java.io.PrintWriter.
                             (java.io.OutputStreamWriter. baos))]
                     (.printStackTrace error pw)
                     (.flush pw)
                     (String. (.toByteArray baos))))}))
so overriding some behavior of yada

borkdude14:12:59

Furthermore, we have the classpath-resource as the last one in the bidi routes