yada

2019-02-07T00:58:31.402700Z

Does yada use the modification date on static files to force browsers to reload? (say for my app.js)

1đź‘Ť
danielcompton 2019-02-07T02:10:28.403Z

From memory yes

2019-02-07T14:38:37.405700Z

@malcolmsparks Thoughts on transmitting metadata being breaking behavior?

borkdude 2019-02-07T19:41:19.407400Z

I’m returning this in a yada response function:

(d/chain (http/get source-url)
             :body
             bs/to-string
             #(scraper/select1 % "title")
             scraper/text
             (fn [title]
               (if (not= "Login Page" title)
                 title
                 (throw (ex-info (str "Could not fetch Confluence page for id " id)
                                 {:status 400})))))
What this does is get the title from some remote page, if it’s “Login Page” I throw an error. I get the right error code in the browser. But after a few of such requests, it seems that the application hangs. Should I handle this in a different way?

borkdude 2019-02-07T19:49:27.407900Z

For some reason I had to add this kind of error handling:

(defn realize-body
  [ex-data]
  (if-let [body (:body ex-data)]
    (assoc ex-data :body (slurp body))
    ex-data))

(d/catch clojure.lang.ExceptionInfo
            (fn [^java.lang.Exception ex]
              (let [d (ex-data ex)
                    d (realize-body d)]
                (throw (ex-info (.getMessage ex) d)))))
and then it works

borkdude 2019-02-07T19:52:21.408200Z

One of these aleph gotchas I guess

dominicm 2019-02-07T20:56:58.409300Z

Seems like yada could be more helpful with its handling of failed deferreds.

borkdude 2019-02-07T22:54:49.410200Z

If you forget to realize the body of an aleph response in case of an exception, weird things happen