All exceptions thrown in router creation are caught, formatted and rethrown by the reitit.core/router function. Exception formatting is done by the exception formatter defined by the :exception router option.
The default exception formatting uses reitit.exception/exception. It produces single-color, partly human-readable, error messages.
(require '[reitit.core :as r])
(r/router
[["/ping"]
["/:user-id/orders"]
["/bulk/:bulk-id"]
["/public/*path"]
["/:version/status"]])

[metosin/reitit-dev "0.8.0-alpha1"]
For human-readable and developer-friendly exception messages, there is reitit.dev.pretty/exception (in the reitit-dev module). It is inspired by the lovely errors messages of ELM and ETA and uses fipp, expound and spell-spec for most of heavy lifting.
(require '[reitit.dev.pretty :as pretty])
(r/router
[["/ping"]
["/:user-id/orders"]
["/bulk/:bulk-id"]
["/public/*path"]
["/:version/status"]]
{:exception pretty/exception})

Behind the scenes, both error formatters are backed by a multimethod, so they are easy to extend.
See the validating route data page.
Can you improve this documentation? These fine people already did:
Tommi Reiman, Juho Teperi, Miikka Koskinen, Joel Kaasinen, Raphaël Saunier, David Harrigan & Marcus SpiegelEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |