From 0437c4a85af5a4fbb68174d7c1266887acc692c1 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sun, 20 Feb 2022 15:47:10 -0600 Subject: ultra basic debugging on handler error --- lazybones-hunchentoot.lisp | 5 ++++- lazybones.lisp | 2 ++ package.lisp | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lazybones-hunchentoot.lisp b/lazybones-hunchentoot.lisp index d752238..4e4ca15 100644 --- a/lazybones-hunchentoot.lisp +++ b/lazybones-hunchentoot.lisp @@ -55,7 +55,9 @@ (declare (ignorable e)) (let ((lzb:*request* request) (lzb:*response* h:*reply*)) - (http-respond nil 500)))))) + (if lzb:*debugging* + (invoke-debugger e) + (http-respond nil 500))))))) ;;; SERVER FUNCTIONS @@ -173,6 +175,7 @@ HEADER-NAME can be a keyword or a string." (defun request-body (&key (request lzb:*request*) (want-stream-p nil)) "Returns the decoded request body. The value returned depends upon the value of the Content-Type request header." + (print "in request body") (if %request-body-cache% %request-body-cache% (setf %request-body-cache% (when (member (request-method request) +hunchentoot-methods-with-body+) diff --git a/lazybones.lisp b/lazybones.lisp index 66192a2..de2aeba 100644 --- a/lazybones.lisp +++ b/lazybones.lisp @@ -18,6 +18,8 @@ "Dynamic variable holding the an APP instance. Dynamically bound by RUN-ENDPOINT so that it is available if needed in request handlers.") +(defvar *debugging* nil) + ;;; HTTP-ERROR CONDITION (define-condition http-error (condition) diff --git a/package.lisp b/package.lisp index 07c003d..c0506df 100644 --- a/package.lisp +++ b/package.lisp @@ -42,6 +42,7 @@ #:*app* #:*request* #:*response* + #:*debugging* #:http-error #:generate-app-documentation #:provision-app -- cgit v1.2.3