mirror of
https://github.com/metosin/reitit.git
synced 2026-01-16 03:09:51 +00:00
Better interceptor error messages
This commit is contained in:
parent
8321589f04
commit
604291f98e
2 changed files with 11 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.interceptor
|
(ns reitit.interceptor
|
||||||
(:require [meta-merge.core :refer [meta-merge]]
|
(:require [meta-merge.core :refer [meta-merge]]
|
||||||
|
[clojure.pprint :as pprint]
|
||||||
[reitit.core :as r]
|
[reitit.core :as r]
|
||||||
[reitit.impl :as impl]))
|
[reitit.impl :as impl]))
|
||||||
|
|
||||||
|
|
@ -20,8 +21,15 @@
|
||||||
(into-interceptor interceptor data opts))
|
(into-interceptor interceptor data opts))
|
||||||
(throw
|
(throw
|
||||||
(ex-info
|
(ex-info
|
||||||
(str "Interceptor " this " not found in registry.")
|
(str
|
||||||
{:keyword this
|
"Interceptor " this " not found in registry.\n\n"
|
||||||
|
(if (seq registry)
|
||||||
|
(str
|
||||||
|
"Available interceptors in registry:\n"
|
||||||
|
(with-out-str
|
||||||
|
(pprint/print-table [:id :description] (for [[k v] registry] {:id k :description v}))))
|
||||||
|
"see [reitit.interceptor/router] on how to add interceptor to the registry.\n") "\n")
|
||||||
|
{:id this
|
||||||
:registry registry}))))
|
:registry registry}))))
|
||||||
|
|
||||||
#?(:clj clojure.lang.APersistentVector
|
#?(:clj clojure.lang.APersistentVector
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
(with-out-str
|
(with-out-str
|
||||||
(pprint/print-table [:id :description] (for [[k v] registry] {:id k :description v}))))
|
(pprint/print-table [:id :description] (for [[k v] registry] {:id k :description v}))))
|
||||||
"see [reitit.middleware/router] on how to add middleware to the registry.\n") "\n")
|
"see [reitit.middleware/router] on how to add middleware to the registry.\n") "\n")
|
||||||
{:keyword this
|
{:id this
|
||||||
:registry registry}))))
|
:registry registry}))))
|
||||||
|
|
||||||
#?(:clj clojure.lang.APersistentVector
|
#?(:clj clojure.lang.APersistentVector
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue