aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-06-10 13:12:59 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-06-10 13:12:59 +0200
commitc7d026da82e901b9f1264e1f1a6369dd9c921921 (patch)
treec63b5bb8dd5a29038316006fbdc02d1be5989dd9 /lisp/mastodon-http.el
parent73d91dd163b7c7a8401aba26c5f41b13277239da (diff)
http: handle --get returning nil from instance
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 60654ff..d6abac4 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -187,9 +187,13 @@ PARAMS is an alist of any extra parameters to send with the request.
SILENT means don't message.
NO-HEADERS means don't collect http response headers.
VECTOR means return json arrays as vectors."
- (let ((buf (mastodon-http--get url params silent)))
+(let ((buf (mastodon-http--get url params silent)))
+ ;; --get can return nil if instance unresponsive:
+ (if (not buf)
+ (user-error "Looks like the server response borked. \
+Is your instance up?")
(with-current-buffer buf
- (mastodon-http--process-response no-headers vector))))
+ (mastodon-http--process-response no-headers vector)))))
(defun mastodon-http--get-json (url &optional params silent vector)
"Return only JSON data from URL request.