[bknr-cvs] hans changed trunk/thirdparty/hunchentoot/
BKNR Commits
bknr at bknr.net
Sun Aug 29 06:53:27 UTC 2010
Revision: 4603
Author: hans
URL: http://bknr.net/trac/changeset/4603
Revive *SHOW-LISP-BACKTRACES-P*
U trunk/thirdparty/hunchentoot/acceptor.lisp
U trunk/thirdparty/hunchentoot/doc/index.xml
U trunk/thirdparty/hunchentoot/request.lisp
U trunk/thirdparty/hunchentoot/specials.lisp
Modified: trunk/thirdparty/hunchentoot/acceptor.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/acceptor.lisp 2010-08-29 06:20:07 UTC (rev 4602)
+++ trunk/thirdparty/hunchentoot/acceptor.lisp 2010-08-29 06:53:27 UTC (rev 4603)
@@ -448,7 +448,7 @@
(when *headers-sent*
(setq *close-hunchentoot-stream* t))
(throw 'handler-done
- (values nil cond))))
+ (values nil cond (and *show-lisp-backtraces-p* (get-backtrace))))))
(warning
(lambda (cond)
(when *log-lisp-warnings-p*
Modified: trunk/thirdparty/hunchentoot/doc/index.xml
===================================================================
--- trunk/thirdparty/hunchentoot/doc/index.xml 2010-08-29 06:20:07 UTC (rev 4602)
+++ trunk/thirdparty/hunchentoot/doc/index.xml 2010-08-29 06:53:27 UTC (rev 4603)
@@ -2683,6 +2683,12 @@
</clix:description>
</clix:special-variable>
+ <clix:special-variable name='*show-lisp-backtraces-p*'>
+ <clix:description>Whether Lisp backtraces should be shown in HTML output if
+ <clix:ref>*SHOW-LISP-ERRORS-P*</clix:ref> is true and an error occurs.
+ </clix:description>
+ </clix:special-variable>
+
<clix:special-variable name='*approved-return-codes*'>
<clix:description>A list of return codes the server should <em>not</em> treat as an error -
see <clix:ref>*HANDLE-HTTP-ERRORS-P*</clix:ref>.
@@ -3036,6 +3042,22 @@
</clix:chapter>
+ <clix:chapter name="debugging" title="Debugging">
+ By default, Hunchentoot intercepts all errors that occur while
+ executing request handlers, logs them to the log file and displays
+ a static error page to the user. While developing applications,
+ you may want to change that behavior so that the debugger is
+ invoked when an error occurs. You can set
+ the <clix:ref>*CATCH-ERRORS-P*</clix:ref> to <code>NIL</code> to
+ make that happen. Alternatively, you may want to have Hunchentoot
+ display detailed error information in the error response page.
+ You can set the <clix:ref>*SHOW-LISP-ERRORS-P*</clix:ref> to a
+ true value to make that happen. If you don't want to see Lisp
+ backtraces in these error pages, you can
+ set <clix:ref>*SHOW-LISP-BACKTRACES-P*</clix:ref>
+ to <code>NIL</code>.
+ </clix:chapter>
+
<clix:chapter name="history" title="History">
Hunchentoot's predecessor <a href="http://weitz.de/tbnl/">TBNL</a>
Modified: trunk/thirdparty/hunchentoot/request.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/request.lisp 2010-08-29 06:20:07 UTC (rev 4602)
+++ trunk/thirdparty/hunchentoot/request.lisp 2010-08-29 06:53:27 UTC (rev 4603)
@@ -216,7 +216,7 @@
(unwind-protect
(with-mapped-conditions ()
(let* ((*request* request))
- (multiple-value-bind (body error)
+ (multiple-value-bind (body error backtrace)
;; skip dispatch if bad request
(when (eql (return-code *reply*) +http-ok+)
(catch 'handler-done
@@ -224,9 +224,13 @@
(when error
(setf (return-code *reply*)
+http-internal-server-error+))
+ (format t "show-error ~A show-backtrace ~A error ~A backtrace: ~A~%"
+ *show-lisp-errors-p* *show-lisp-backtraces-p* error backtrace)
(start-output :content (cond ((and error *show-lisp-errors-p*)
- (format nil "<pre>~A</pre>"
- (escape-for-html (format nil "~A" error))))
+ (format nil "<pre>~A~@[~%~%Backtrace:~A~]</pre>"
+ (escape-for-html (format nil "~A" error))
+ (when *show-lisp-backtraces-p*
+ (escape-for-html (format nil "~A" backtrace)))))
(error
"An error has occured.")
(t body))))))
Modified: trunk/thirdparty/hunchentoot/specials.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/specials.lisp 2010-08-29 06:20:07 UTC (rev 4602)
+++ trunk/thirdparty/hunchentoot/specials.lisp 2010-08-29 06:53:27 UTC (rev 4603)
@@ -196,6 +196,9 @@
(defvar *show-lisp-errors-p* nil
"Whether Lisp errors in request handlers should be shown in HTML output.")
+(defvar *show-lisp-backtraces-p* t
+ "Whether Lisp errors shown in HTML output should contain backtrace information.")
+
(defvar *log-lisp-errors-p* t
"Whether Lisp errors in request handlers should be logged.")
More information about the Bknr-cvs
mailing list