-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patherrors.lisp
34 lines (30 loc) · 1.29 KB
/
errors.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(in-package :easy-routes)
(defclass easy-routes-errors-acceptor (hunchentoot-errors:errors-acceptor)
())
(defmethod hunchentoot-errors::acceptor-log-error
(stream (acceptor easy-routes-errors-acceptor) log-level format-string &rest format-arguments)
(declare (ignore format-arguments))
(call-next-method)
(let ((route (and (boundp 'hunchentoot:*request*)
(routes:match (acceptor-routes-mapper (hunchentoot:acceptor-name acceptor))
(hunchentoot:request-uri*)))))
(when route
(format stream "ROUTE: ")
(print-route route stream)
(terpri stream))))
(defmethod hunchentoot:acceptor-status-message ((acceptor easy-routes-errors-acceptor) http-status-code &key &allow-other-keys)
(concatenate
'string
(call-next-method)
(if hunchentoot:*show-lisp-errors-p*
(let ((route (and (boundp 'hunchentoot:*request*)
(routes:match (acceptor-routes-mapper (hunchentoot:acceptor-name acceptor))
(hunchentoot:request-uri*)))))
(when route
(with-output-to-string (msg)
(format msg "<h1>Route</h1>~%")
(format msg "<p>")
(print-route route msg)
(format msg "</p>"))))
"")))
(export 'easy-routes-errors-acceptor)