Add trivial-backtrace
This commit is contained in:
parent
47bc8cc9ee
commit
4949324e05
4 changed files with 14 additions and 3 deletions
src
|
@ -1,8 +1,7 @@
|
|||
(defpackage #:hp/config
|
||||
(:use #:cl)
|
||||
(:import-from #:log4cl)
|
||||
(:export #:*env*
|
||||
#:dev-mode-p
|
||||
(:export #:dev-mode-p
|
||||
#:prod-mode-p))
|
||||
(in-package #:hp/config)
|
||||
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
(defpackage #:hp/middlewares/recovery
|
||||
(:use #:cl)
|
||||
(:import-from #:log4cl)
|
||||
(:local-nicknames (#:tb #:trivial-backtrace))
|
||||
(:local-nicknames (#:cfg #:hp/config))
|
||||
(:export #:*recovery*))
|
||||
(in-package #:hp/middlewares/recovery)
|
||||
|
||||
(defun message (condition)
|
||||
(if (cfg:dev-mode-p)
|
||||
(tb:print-backtrace condition :output nil)
|
||||
"Internal Server Error"))
|
||||
|
||||
(defparameter *recovery*
|
||||
(lambda (app)
|
||||
(lambda (env)
|
||||
|
@ -12,4 +19,4 @@
|
|||
(error (c)
|
||||
(log:error "Unhandled error caught: ~a" c)
|
||||
`(500 (:content-type "text/plain")
|
||||
("Internal Server Error")))))))
|
||||
(,(message c))))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue