mirror of
https://github.com/metosin/reitit.git
synced 2025-12-24 10:58:25 +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
|
||||
(:require [meta-merge.core :refer [meta-merge]]
|
||||
[clojure.pprint :as pprint]
|
||||
[reitit.core :as r]
|
||||
[reitit.impl :as impl]))
|
||||
|
||||
|
|
@ -20,8 +21,15 @@
|
|||
(into-interceptor interceptor data opts))
|
||||
(throw
|
||||
(ex-info
|
||||
(str "Interceptor " this " not found in registry.")
|
||||
{:keyword this
|
||||
(str
|
||||
"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}))))
|
||||
|
||||
#?(:clj clojure.lang.APersistentVector
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
(with-out-str
|
||||
(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")
|
||||
{:keyword this
|
||||
{:id this
|
||||
:registry registry}))))
|
||||
|
||||
#?(:clj clojure.lang.APersistentVector
|
||||
|
|
|
|||
Loading…
Reference in a new issue