aboutsummaryrefslogtreecommitdiff
path: root/oneliners.api-client.lisp
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-02-18 13:55:10 -0600
committerColin Okay <okay@toyful.space>2022-02-18 13:55:10 -0600
commit4d2afc4e3c6cc5ce5be4f0d421da49ca6cead09a (patch)
treeb35a02ecbade5622c0f4f54d450f54870a5dc10d /oneliners.api-client.lisp
parentf4b6c94bbd91d5061f1a449f407999be7e8e5814 (diff)
logging in, redeeming tokens
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)