Skip to content

lisplizards/lack-middleware-errors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lack-middleware-errors

Usage

Wrap app:

(funcall lack/middleware/errors:*lack-middleware-errors*
         *app*
         :app (foo.lisp.vinland/errors-app/simple/basic:make-app
               :root demo-app/config:*static-errors-directory*
               :static-file-types demo-app/http-error:*static-file-types*
               :handlers demo-app/http-error:*http-errors*)
         :intercept (lambda (condition)
                      (declare (type error condition))
                      (typecase condition
                        (foo.lisp.http-response:http-error (slot-value condition 'foo.lisp.http-response:status-code))
                        (foo.lisp.raven:no-route-error 404))))

Lack Builder:

(lack:builder
 (:errors :app (foo.lisp.vinland/errors-app/simple/basic:make-app
                :root demo-app/config:*static-errors-directory*
                :static-file-types demo-app/http-error:*static-file-types*
                :handlers demo-app/http-error:*http-errors*)
          :intercept (lambda (condition)
                       (declare (type error condition))
                       (typecase condition
                         (foo.lisp.http-response:http-error (slot-value condition 'foo.lisp.http-response:status-code))
                         (foo.lisp.raven:no-route-error 404))))
 *app*)

Options

  • INTERCEPT: required; function that takes an error condition and returns an HTTP error status response code; a NIL return value results in response code 500
  • APP: required; function that takes an ENV list and returns a response (a Clack application); before forwarding to the errors app, the middleware re-writes the path-info to the status code returned by function INTERCEPT and re-writes the request-method to GET

Development

Run tests:

(asdf:test-system :foo.lisp.lack-middleware-errors)

Installation

Not in Quicklisp, so clone to "local-projects/".

Dependencies

Tests

Author

Copyright

Copyright (c) 2024 John Newton

License

Apache-2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published