aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-01-28 16:27:24 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-01-28 16:27:24 +0100
commit405ad09845e152990df09a3f2f1ed52e178df2c0 (patch)
tree68c57c880c1b37d7baf88217c7358b701fc79168
parent36b6a905957c9207b7a5b738f3744745f7b088dd (diff)
list-favouriters/boosters: handle null response
-rw-r--r--lisp/mastodon-toot.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 35fe457..3f19a0d 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -441,18 +441,21 @@ With FAVOURITE, list favouriters, else list boosters."
(url (mastodon-http--api
(format "statuses/%s/%s" base-toot endpoint)))
(params '(("limit" . "80")))
- (json (mastodon-http--get-json url params))
- (handles (mapcar (lambda (x) (alist-get 'acct x)) json))
- (type-string (if favourite "Favouriters" "Boosters")))
- (if (not handles)
- (error "Looks like this toot has no %s" type-string)
- (let ((choice
- (completing-read
- (format "%s (enter to view profile): " type-string)
- handles
- nil
- t)))
- (mastodon-profile--show-user choice)))))
+ (json (mastodon-http--get-json url params)))
+ (if (eq (caar json) 'error)
+ (error "%s (Status does not exist or is private)"
+ (alist-get 'error json))
+ (let ((handles (mapcar (lambda (x) (alist-get 'acct x)) json))
+ (type-string (if favourite "Favouriters" "Boosters")))
+ (if (not handles)
+ (error "Looks like this toot has no %s" type-string)
+ (let ((choice
+ (completing-read
+ (format "%s (enter to view profile): " type-string)
+ handles
+ nil
+ t)))
+ (mastodon-profile--show-user choice)))))))
(defun mastodon-toot--copy-toot-url ()
"Copy URL of toot at point.