Fork me on GitHub

I don’t think I quite understand error handling. According to > As long as there is an error attached to that key, Pedestal will not invoke the usual `:enter` and `:leave` functions. Instead, it looks for the next interceptor in the chain that has a `:error` function attached to it. So I would expect that throwing an exception in the :enter function would look for the exception handling Interceptor next in the queue. However, the behaviour actually seems to be the opposite: only Interceptors that come before the throwing Interceptor are considered.


I guess “the chain” really means “Interceptors that have been visited at least once”.


and then anything that comes after the throwing Interceptor is thrown out.


So should error handlers always be put at the very beginning of the Interceptors vector?


yes, a thrown exception AFAIK will terminate the queue and start unwinding

👍 3

I found some tests with routing with :app-name // :host But I can't make it work. There is any sample app using this? (i prefer tabular routes once all my routes are tabular at this moment)


I'm trying with

::http/routes (vec (concat
                     (route/expand-routes red-green)
                     (route/expand-routes todo-list)))
It throws
Execution error (AssertionError) at io.pedestal.http.route.definition.terse/eval12443$fn (terse.clj:52).
Assert failed: Cannot expand '[:path "/red"]' as a route. Expected a verb map or path string, but found a class clojure.lang.MapEntry instead


OK, i should just concat, not vec concat


Pedestal is awesome. If there is docs for it, it would be a good clojure selling point


@U2J4FRT2T by using vec you inadvertently switched routing syntax. FWIW, the docs do the relation between routing syntax and data structure type.