All Projects → eudoxia0 → clack-errors

eudoxia0 / clack-errors

Licence: other
Error page middleware for Clack.

Programming Languages

javascript
184084 projects - #8 most used programming language
common lisp
692 projects
CSS
56736 projects
HTML
75241 projects

clack-errors

Build Status Quicklisp

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

This,

(clack:clackup
  (funcall clack-errors:*clack-error-middleware*
           *my-clack-app*
           :debug t)
  :port 8000)))

will wrap your Clack up in the clack-errors middleware, start the server and return a handler object.

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.

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
  (funcall clack-errors:*clack-error-middleware*
    *app*
    :fn (lambda (condition) "500 Internal Server Error")))

License

Copyright (c) 2013–2019 Fernando Borretti ([email protected])

Licensed under the LLGPL License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].