diff -urN --exclude=_darcs hunchentoot-1.0.0/acceptor.lisp hunchentoot/acceptor.lisp
--- hunchentoot-1.0.0/acceptor.lisp	2009-02-18 21:25:19.000000000 +0100
+++ hunchentoot/acceptor.lisp	2009-11-15 14:55:48.000000000 +0100
@@ -173,6 +173,17 @@
 active instances of ACCEPTOR \(listening on different ports) at the
 same time."))
 
+(defclass debugging-acceptor (acceptor)
+     ((debug-connection-errors-p :initarg :debug-connection-errors-p
+                                 :accessor debug-connection-errors-p
+                                 :documentation "A flag that enables 
+entering the debugger if a connection-related error (e.g. a premature
+connection drop by the client) occurs."))
+  (:default-initargs
+      :debug-connection-errors-p nil)
+  (:documentation "This class provides a Hunchentoot webserver that
+enters the debugger if an error handler occurs during request handling."))
+
 (defmethod print-object ((acceptor acceptor) stream)
   (print-unreadable-object (acceptor stream :type t)
     (format stream "\(host ~A, port ~A)"
@@ -235,6 +246,19 @@
 subclasses of ACCEPTOR must specialize this method to signal that
 they're using secure connections - see the SSL-ACCEPTOR class."))
 
+(defgeneric invoke-process-connection-with-error-handling
+    (acceptor socket continuation)
+  (:documentation "Handles connection errors on SOCKET for ACCEPTOR
+that occur while running CONTINUATION."))
+
+(defgeneric invoke-process-request-with-error-handling
+    (acceptor request continuation)
+  (:documentation "Handles errors that occur while running
+CONTINUATION to process a REQUEST on ACCEPTOR.
+
+This is useful to specialize if you want to handle errors that occur
+only on specific requests."))
+
 ;; general implementation
 
 (defmethod start ((acceptor acceptor))
@@ -268,22 +292,37 @@
          (chunked-stream-stream stream))
         (t stream)))
 
-(defmethod process-connection :around ((*acceptor* acceptor) (socket t))
-  ;; this around method is used for error handling
+(defmethod invoke-process-connection-with-error-handling ((*acceptor* acceptor)
+                                                          socket continuation)
   (declare (ignore socket))
-  ;; note that this method also binds *ACCEPTOR*
+  ;; Handle connection errors if they occur.
   (handler-bind ((error
                   ;; abort if there's an error which isn't caught inside
                   (lambda (cond)
                     (log-message *lisp-errors-log-level*
                                  "Error while processing connection: ~A" cond)
-                    (return-from process-connection)))
+                    (return-from invoke-process-connection-with-error-handling)))
                  (warning
                   ;; log all warnings which aren't caught inside
                   (lambda (cond)
                     (log-message *lisp-warnings-log-level*
                                  "Warning while processing connection: ~A" cond))))
-    (call-next-method)))
+    (funcall continuation)))
+
+(defmethod invoke-process-connection-with-error-handling ((*acceptor* debugging-acceptor)
+                                                          socket continuation)
+  (declare (ignore socket))
+  ;; Use the default error handling behavior, which is governed by the
+  ;; host lisp's debugger-hook
+  (if (debug-connection-errors-p *acceptor*)
+      (funcall continuation)
+      (call-next-method)))
+
+(defmethod process-connection :around ((*acceptor* acceptor) (socket t))
+  ;; this around method is used for error handling
+  (declare (ignore socket))
+  ;; note that this method also binds *ACCEPTOR*
+  (invoke-process-connection-with-error-handling *acceptor* socket #'call-next-method))
 
 (defmethod process-connection ((*acceptor* acceptor) (socket t))
   (let ((*hunchentoot-stream*
@@ -417,3 +456,51 @@
         when action return (funcall action)
         finally (setf (return-code *reply*) +http-not-found+)))
 
+;;; Handling errors that occur in request handling:
+
+(defmethod invoke-process-request-with-error-handling ((*acceptor* acceptor)
+                                                       *request* continuation)
+  "Standard error handling mechanism for the request processor.  Logs
+errors if *LOG-LISP-ERRORS-P* is set and logs warnings for
+*LOG-LISP-WARNINGS-P*."
+  (handler-bind ((error
+                  (lambda (cond)
+                    (when *log-lisp-errors-p*
+                      (log-message *lisp-errors-log-level* "~A" cond))
+                    ;; if the headers were already sent
+                    ;; the error happens within the body
+                    ;; and we have to close the stream
+                    (when *headers-sent*
+                      (setq *close-hunchentoot-stream* t))
+                    (throw 'handler-done
+                      (values nil cond))))
+                 (warning
+                  (lambda (cond)
+                    (when *log-lisp-warnings-p*
+                      (log-message *lisp-warnings-log-level* "~A" cond)))))
+    (funcall continuation)))
+
+(defmethod invoke-process-request-with-error-handling ((*acceptor*
+                                                        debugging-acceptor)
+                                                       *request* continuation)
+  "Mechanism for entering the debugger if an unhandled error occurs
+while handling a request."
+  (let* ((aborted t))
+    (unwind-protect
+        (let ((*debugger-hook*
+               (lambda (cond prev-hook)
+                 (setf aborted cond)
+                 (let ((*debugger-hook* prev-hook))
+                   (invoke-debugger cond)))))
+          (with-simple-restart (abort "Abort handling ~A ~A"
+                                      (request-method *request*)
+                                      (request-uri *request*))
+            (multiple-value-prog1
+              (funcall continuation)
+              ;; When execution continues, close the stream only if so
+              ;; desired:
+              (setq aborted nil))))
+      (when aborted
+        (when *headers-sent*
+          (setq *close-hunchentoot-stream* t))
+        (throw 'handler-done (values nil aborted))))))
\ No newline at end of file
diff -urN --exclude=_darcs hunchentoot-1.0.0/doc/index.xml hunchentoot/doc/index.xml
--- hunchentoot-1.0.0/doc/index.xml	2009-02-19 02:13:15.000000000 +0100
+++ hunchentoot/doc/index.xml	2009-11-14 12:16:46.000000000 +0100
@@ -348,6 +348,13 @@
     </clix:description>
   </clix:class>
 
+  <clix:class name='debugging-acceptor'>
+    <clix:description>The default Hunchentoot webserver behavior is to catch errors and
+log them (see <clix:ref>*log-lisp-errors-p*</clix:ref> and
+<clix:ref>*log-lisp-warnings-p*</clix:ref>). If you prefer to open a debugger window instead (e.g., for development), you can use this class instead of <clix:ref>acceptor</clix:ref>.
+    </clix:description>
+  </clix:class>
+  
   <clix:class name='ssl-acceptor'>
     <clix:description>Create and <clix:ref>START</clix:ref> an instance of this class
 (instead of <clix:ref>ACCEPTOR</clix:ref>) if you want an https server.  There are two
@@ -652,6 +659,23 @@
     </clix:description>
   </clix:function>
 
+  <clix:function generic='true' name='invoke-process-request-with-error-handling'>
+  <clix:lambda-list>acceptor request continuation</clix:lambda-list>
+  <clix:description>Can be used to override the error handling behavior of an acceptor.
+The default method of <clix:ref>ACCEPTOR</clix:ref> logs errors if
+<clix:ref>*log-lisp-errors-p*</clix:ref> is set.
+  </clix:description>
+  </clix:function>
+
+  <clix:function generic='true' name='invoke-process-connection-with-error-handling'>
+  <clix:lambda-list>acceptor socket continuation</clix:lambda-list>
+  <clix:description>Can be used to override the error handling behavior for connection
+handling. The default method of <clix:ref>ACCEPTOR</clix:ref> logs connection errors
+as they occur, while <clix:ref>DEBUGGING-ACCEPTOR</clix:ref> invokes the debugger if
+debug-connection-errors-p is set.
+  </clix:description>
+  </clix:function>
+  
     </clix:subchapter>
 
     <clix:subchapter name="taskmasters" title="Taskmasters">
diff -urN --exclude=_darcs hunchentoot-1.0.0/packages.lisp hunchentoot/packages.lisp
--- hunchentoot-1.0.0/packages.lisp	2009-02-19 00:05:18.000000000 +0100
+++ hunchentoot/packages.lisp	2009-11-14 12:05:39.000000000 +0100
@@ -132,6 +132,9 @@
            "ACCEPTOR-REPLY-CLASS"
            "ACCEPTOR-REQUEST-CLASS"
            "ACCEPTOR-SSL-P"
+           "DEBUGGING-ACCEPTOR"
+           "INVOKE-PROCESS-REQUEST-WITH-ERROR-HANDLING"
+           "INVOKE-PROCESS-CONNECTION-WITH-ERROR-HANDLING"
            #-:hunchentoot-no-ssl "ACCEPTOR-SSL-CERTIFICATE-FILE"               
            #-:hunchentoot-no-ssl "ACCEPTOR-SSL-PRIVATEKEY-FILE"
            #-:hunchentoot-no-ssl "ACCEPTOR-SSL-PRIVATEKEY-PASSWORD"
diff -urN --exclude=_darcs hunchentoot-1.0.0/request.lisp hunchentoot/request.lisp
--- hunchentoot-1.0.0/request.lisp	2009-02-19 01:07:57.000000000 +0100
+++ hunchentoot/request.lisp	2009-11-14 12:35:40.000000000 +0100
@@ -219,25 +219,13 @@
          (let* ((*request* request))
            (multiple-value-bind (body error)
                (catch 'handler-done
-                 (handler-bind ((error
-                                 (lambda (cond)
-                                   (when *log-lisp-errors-p*
-                                     (log-message *lisp-errors-log-level* "~A" cond))
-                                   ;; if the headers were already sent
-                                   ;; the error happens within the body
-                                   ;; and we have to close the stream
-                                   (when *headers-sent*
-                                     (setq *close-hunchentoot-stream* t))
-                                   (throw 'handler-done
-                                     (values nil cond))))
-                                (warning
-                                 (lambda (cond)
-                                   (when *log-lisp-warnings-p*
-                                     (log-message *lisp-warnings-log-level* "~A" cond)))))
-                   ;; skip dispatch if bad request
-                   (when (eql (return-code *reply*) +http-ok+)
-                     ;; now do the work
-                     (funcall (acceptor-request-dispatcher *acceptor*) *request*))))
+                 (invoke-process-request-with-error-handling
+                  *acceptor* *request*
+                  (lambda ()
+                    ;; skip dispatch if bad request
+                    (when (eql (return-code *reply*) +http-ok+)
+                      ;; now do the work
+                      (funcall (acceptor-request-dispatcher *acceptor*) *request*)))))
              (when error
                (setf (return-code *reply*)
                      +http-internal-server-error+))
