From c7d026da82e901b9f1264e1f1a6369dd9c921921 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 10 Jun 2024 13:12:59 +0200 Subject: http: handle --get returning nil from instance --- lisp/mastodon-http.el | 8 ++++++-- 1 file 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. -- cgit v1.2.3