This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-03-29
Channels
- # announcements (9)
- # aws (1)
- # beginners (133)
- # boot (2)
- # calva (94)
- # cider (48)
- # cljdoc (7)
- # cljsrn (22)
- # clojure (128)
- # clojure-europe (22)
- # clojure-finland (7)
- # clojure-greece (6)
- # clojure-losangeles (3)
- # clojure-nl (81)
- # clojure-spec (30)
- # clojure-uk (60)
- # clojure-ukraine (1)
- # clojurescript (45)
- # core-async (26)
- # cursive (18)
- # datomic (12)
- # defnpodcast (1)
- # duct (4)
- # editors (4)
- # emacs (6)
- # fulcro (37)
- # graphql (4)
- # jobs (2)
- # jobs-rus (1)
- # juxt (7)
- # kaocha (2)
- # leiningen (1)
- # nrepl (22)
- # off-topic (2)
- # re-frame (16)
- # reagent (8)
- # reitit (22)
- # ring-swagger (5)
- # shadow-cljs (81)
- # tools-deps (4)
@ikitommi presented ongoing work on error messages in reitit
at Tampere Clojure Meetup on Tuesday: https://youtu.be/RA2wo2wxfSk
a.k.a. live demo of https://clojurians.slack.com/archives/C7YF1SBT3/p1553369376171400
a.k.a. live demo of https://clojurians.slack.com/archives/C7YF1SBT3/p1553369376171400
{:post (over-capacity? capacity)}
expands to {:post {:handler (over-capacity? capacity)}}
and the `:handler is a function of request->response
Simple interceptor example for reference: https://metosin.github.io/reitit/http/interceptors.html
Yes, sorry. I was typing the app bit straight into Slack. I've updated the code now.
I’m not 100% sure if the interceptor will catch it’s own errors on :error
, but it should.
When throwing the Exception in the Interceptor should the exception-interceptor pick it up? Then call the :error on the same interceptor that threw the exception?
(require '[reitit.http :as http])
(require '[reitit.interceptor.sieppari :as sieppari])
(def app
(http/ring-handler
(http/router
["/" {:interceptors [{:enter (fn [ctx] (throw (RuntimeException. "1")))
:error (fn [ctx] (-> ctx
(dissoc :error)
(assoc :response {:statys 200, :body "fail"})))}]}])
{:executor sieppari/executor}))
(app {:request-method :get, :uri "/"})
; {:statys 200, :body "fail"}