Liking cljdoc? Tell your friends :D

hyper.render.error

Built-in error renderers for use as the :render-error option on hyper.core/create-handler.

An error renderer is a function (fn [error req] -> hiccup) that produces the markup shown in place of a view whose render-fn threw. The exception is always logged via telemere — the renderer is purely a UI concern.

Two renderers are provided:

  • minimal (default): generic, production-safe message with no exception details. Use in production.
  • explain: developer-friendly message with the exception class, message, ex-data, and the full stack trace including the cause chain. Use in development.

This namespace also provides not-found, the default :not-found renderer — a (fn [req] -> hiccup) shown when no route matches a request.

You can also supply your own renderer. Pass a Var to pick up REPL redefinitions without restarting the server:

(h/create-handler routes
                  :render-error  my.app.errors/branded-error)

(h/create-handler routes
                  :render-error  #'my.app.errors/branded-error)
Built-in error renderers for use as the `:render-error` option on
`hyper.core/create-handler`.

An error renderer is a function `(fn [error req] -> hiccup)` that produces
the markup shown in place of a view whose render-fn threw.  The exception
is always logged via telemere — the renderer is purely a UI concern.

Two renderers are provided:

- `minimal` (default): generic, production-safe message with no exception
  details.  Use in production.
- `explain`: developer-friendly message with the exception class, message,
  `ex-data`, and the full stack trace including the cause chain.  Use in
  development.

This namespace also provides `not-found`, the default `:not-found`
renderer — a `(fn [req] -> hiccup)` shown when no route matches a request.

You can also supply your own renderer.  Pass a Var to pick up REPL
redefinitions without restarting the server:

    (h/create-handler routes
                      :render-error  my.app.errors/branded-error)

    (h/create-handler routes
                      :render-error  #'my.app.errors/branded-error)
raw docstring

explainclj

(explain error _req)

Developer-friendly error renderer.

Renders the exception class, message, any ex-data, and the full stack trace (including cause chain). Intended for development environments — do not enable in production.

Configure via:

(h/create-handler routes :render-error hyper.render.error/explain)
Developer-friendly error renderer.

Renders the exception class, message, any `ex-data`, and the full stack
trace (including cause chain).  Intended for development environments —
do not enable in production.

Configure via:

    (h/create-handler routes :render-error hyper.render.error/explain)
sourceraw docstring

minimalclj

(minimal _error _req)

Production-safe error renderer.

Renders a generic apology without leaking any exception details. This is the default :render-error for create-handler.

Production-safe error renderer.

Renders a generic apology without leaking any exception details.  This is
the default `:render-error` for `create-handler`.
sourceraw docstring

not-foundclj

(not-found _req)

Default :not-found renderer for hyper.core/create-handler.

A not-found renderer is a function (fn [req] -> hiccup) shown when no route matches; it can read the attempted :uri from the request. This default is generic and production-safe — supply your own (a Var to pick up REPL redefinitions) to brand it:

(h/create-handler routes :not-found #'my.app.errors/not-found-page)
Default `:not-found` renderer for `hyper.core/create-handler`.

A not-found renderer is a function `(fn [req] -> hiccup)` shown when no route
matches; it can read the attempted `:uri` from the request.  This default is
generic and production-safe — supply your own (a Var to pick up REPL
redefinitions) to brand it:

    (h/create-handler routes :not-found #'my.app.errors/not-found-page)
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close