From b264fa362b9dbc02731d99963cdc71d55885cdaa Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Thu, 23 Oct 2025 10:48:51 +0300 Subject: Some extra code to deal with bad responses --- src/transport.lisp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/transport.lisp b/src/transport.lisp index 12e09f4..52d0dcf 100644 --- a/src/transport.lisp +++ b/src/transport.lisp @@ -29,8 +29,12 @@ (handler-case (dex:request uri :method method :content content :read-timeout 60 :connect-timeout 60) ;; We deal with too many requests manually (dex:http-request-too-many-requests (e) (dex:ignore-and-continue e)) - (dex:http-request-failed (e) (funcall retrier e)) - (cl+ssl::ssl-error (e) (funcall retrier e))))) + (dex:http-request-failed (e) + (log:warn "HTTP request failed: ~A" e) + (funcall retrier e)) + (cl+ssl::ssl-error (e) + (log:warn "SSL error: ~A" e) + (funcall retrier e))))) ;; TODO: (alist string t) (-> do-call% (http-method string t list) t) @@ -39,7 +43,7 @@ See `do-call'." (let* ((body (req uri method args-encoded)) - (hash (jzon:parse body))) + (hash (if body (jzon:parse body) (error "TG replied with nothing!")))) (if (gethash "ok" hash) (parse-value out-type (gethash "result" hash)) (let* ((error-code (gethash "error_code" hash)) -- cgit v1.2.3