clack-errors

https://github.com/eudoxia0/clack-errors.git

git clone 'https://github.com/eudoxia0/clack-errors.git'

(ql:quickload :clack-errors)
12

clack-errors

Build Status

Development screenshot Production screenshot

A clone of better_errors for Clack.

By default, when Clack throws an exception when rendering a page, the server waits for the response until it times out while the exception waits in the REPL. This isn't very useful. So now there's this.

Usage

Simply add the <clack-error-middleware> to your application's clackup form.

(clack:clackup
  (builder
    clack-errors:<clack-error-middleware>
    *app*))

By default, the middleware will show all information. In a production environment, you'll want to initialize this with the :debug parameter set to NIL.

If you use Envy to manage configuration, you'd initialize it like this:

(clack:clackup
  (builder
    (clack-errors:<clack-error-middleware>
      :debug (getf (envy:config :myapp) :debug))
    *app*))

Using a Custom Error Page

The middleware can be initialized with the :fn slot set to a lambda that takes a condition as its argument and returns the HTML string to return to the client.

(clack:clackup
  (builder
    (clack-errors:<clack-error-middleware>
      :fn (lambda (condition) "500 Internal Server Error")
    *app*))

License

Copyright (c) 2013-2015 Fernando Borretti (eudoxiahp@gmail.com)

Licensed under the LLGPL License.