aboutsummaryrefslogtreecommitdiff
path: root/lazybones.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lazybones.lisp')
-rw-r--r--lazybones.lisp22
1 files changed, 9 insertions, 13 deletions
diff --git a/lazybones.lisp b/lazybones.lisp
index bab6ca2..fe2ebc3 100644
--- a/lazybones.lisp
+++ b/lazybones.lisp
@@ -18,6 +18,13 @@
"Dynamic variable holding the an APP instance. Dynamically bound by
RUN-ENDPOINT so that it is available if needed in request handlers.")
+;;; HTTP-ERROR CONDITION
+
+(define-condition http-error (condition)
+ ((code :initarg :code)
+ (content :initarg :content)))
+
+
;;; APP NAMESPACE
(lisp-namespace:define-namespace lazybones)
@@ -365,21 +372,10 @@ making a new one if not."
"Like DEFENDPOINT but uses the current package name as the app name."
`(defendpoint ,(default-app-name) ,method ,route ,params ,options ,@body))
-
-
-
;;; ENDPOINT HANDLING UTILITIES
-
-(defun http-ok (content)
- "Content should be a string, a byte-vector, or a pathname to a local
-file. CONTENT-TYPE should be a MIME type string."
- (http-respond 200 content))
-
(defun http-err (code &optional content)
- "*APP*, *RESPONSE* and *REQUEST* should all be defined here."
- (http-respond
- code
- content))
+ "Singals an HTTP-ERROR with code and content."
+ (signal 'http-error :content content :code code))