aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-15 11:27:48 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-15 11:27:48 +0100
commit2197fa013ec02cd82750a319c1c314fdb4a7c2a4 (patch)
tree29ab9b5d65142ad84bbf507a0011f9a4f0815227
parent370f0a8367e381345950e145554481d988a1709c (diff)
http--triage: add 404, don't process json in that case
-rw-r--r--lisp/mastodon-http.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index e69a5c9..106c76b 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -89,8 +89,11 @@ Message status and JSON error from RESPONSE if unsuccessful."
(if (string-prefix-p "2" status)
(funcall success)
(switch-to-buffer response)
- (let ((json-response (mastodon-http--process-json)))
- (message "Error %s: %s" status (alist-get 'error json-response))))))
+ ;; 404 returns http response not JSON:
+ (if (string-prefix-p "404" status)
+ (message "Error %s: page not found" status)
+ (let ((json-response (mastodon-http--process-json)))
+ (message "Error %s: %s" status (alist-get 'error json-response)))))))
(defun mastodon-http--read-file-as-string (filename)
"Read a file FILENAME as a string. Used to generate image preview."