aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol.lisp')
-rw-r--r--src/protocol.lisp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/protocol.lisp b/src/protocol.lisp
index f88ec1e..3da16ec 100644
--- a/src/protocol.lisp
+++ b/src/protocol.lisp
@@ -8,19 +8,21 @@
(define-condition protocol-error (error)
((raw-request
:reader raw-request
+ :initform nil
:initarg :raw-request
:documentation "The server backend's request object, if available")
(class
- :reader endpoint-class
- :initarg :class
- :documentation "The class registered to handle the raw-request.")
+ :reader endpoint-class
+ :initform nil
+ :initarg :class
+ :documentation "The class registered to handle the raw-request.")
(note
:reader note
:initform nil
:initarg :note
:type (or null string))
(status-code
- :reader status-code
+ :qreader status-code
:initform nil
:initarg :status-code
:type (or nil (integer 100 599))))
@@ -50,16 +52,23 @@ that the request has insufficient permissions to evoke the endpoint handler. "))
(define-condition slot-required (protocol-error)
((mising-slot
:reader missing-slot
+ :initform nil
:initarg :slot))
(:default-initargs :status-code 400)
(:documentation "Signalled whenever a required slot is missing from a endpoint
- instance object."))
+ instance object.")
+ (:report (lambda (c s)
+ (format s "HTTP ERROR ~a, SLOT-REQUIRED: ~a in ~a"
+ (status-code c)
+ (missing-slot c)
+ (endpoint-class c)))))
(define-condition not-found (protocol-error) ()
(:default-initargs :status-code 404))
(defgeneric protocol-error-result (err)
- (:documentation "The content and mimetype to returned to the client having encountered
+ (:documentation
+ "The content and mimetype to returned to the client having encountered
an error.")
(:method ((err error)) (values nil nil)))
@@ -80,7 +89,6 @@ that the request has insufficient permissions to evoke the endpoint handler. "))
(defmethod http:acceptor-dispatch-request :around ((acceptor http:acceptor) request)
(handler-case (call-next-method)
-
(error (err)
(if *debugging*
(invoke-debugger err)
@@ -96,7 +104,7 @@ that the request has insufficient permissions to evoke the endpoint handler. "))
(defun slot-required (ep slot)
"Signals a SLOT-REQUIRED condition"
- (protocol-error 'slot-required ep :missing-slot slot))
+ (protocol-error 'slot-required ep :slot slot))
;;; HANDLER PROTOCOL