aboutsummaryrefslogtreecommitdiff
path: root/oneliners.api-client.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'oneliners.api-client.lisp')
-rw-r--r--oneliners.api-client.lisp9
1 files changed, 7 insertions, 2 deletions
diff --git a/oneliners.api-client.lisp b/oneliners.api-client.lisp
index 98c156d..8d43eae 100644
--- a/oneliners.api-client.lisp
+++ b/oneliners.api-client.lisp
@@ -47,7 +47,8 @@ header.
COOKIES should be an instance of CL-COOKIE:COOKIE-JAR. Defaults to
*COOKIES*.
"
- (let ((content-type-var (gensym)))
+ (let ((content-type-var (gensym))
+ (http-error-var (gensym)))
`(let ((*host* (or ,host *host*))
(*body* (or ,body *body*))
(*headers* (or ,headers *headers*))
@@ -55,7 +56,11 @@ COOKIES should be an instance of CL-COOKIE:COOKIE-JAR. Defaults to
(,content-type-var ,content-type))
(when ,content-type-var
(push (cons "Content-Type" ,content-type-var) *headers*))
- ,@forms)))
+ (handler-case (progn ,@forms)
+ (dex:http-request-failed (,http-error-var)
+ (format *error-output* "~a -- ~a"
+ (dex:response-status ,http-error-var)
+ (dex:response-body ,http-error-var)))))))
(DEFUN GET--SEARCH (&KEY TAGS LIMIT NOTFLAGGED)