Stricter match-by-name! ?
metametadata opened this issue · comments
I'm using it for the first time and expected match-by-name!
to throw if the provided name
doesn't exist. But it currently returns nil
instead.
FWIW, so far I've written a small helper to get the desired strictness:
(defn path
"Returns path corresponding to the route with the specified name or throws."
[request name]
(if-some [ret (reitit/match->path (reitit/match-by-name! (:reitit.core/router request) name))]
ret
(throw (ex-info "failure matching route by name" {:name name}))))