branch: elpa/fedi
commit cff7b83779ae84ac0ccbbee8b5e47e29b03c2b9a
Author: marty hiatt <martianhiatus [a t] riseup [d o t] net>
Commit: marty hiatt <martianhiatus [a t] riseup [d o t] net>
cond for triage, and user-error call for non-404 error status
---
fedi-http.el | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/fedi-http.el b/fedi-http.el
index 92061e23ac1..da5a400844d 100644
--- a/fedi-http.el
+++ b/fedi-http.el
@@ -110,13 +110,15 @@ Call SUCCESS if successful. Message status and JSON error
from
RESPONSE if unsuccessful."
(let ((status (with-current-buffer response
(fedi-http--status))))
- (if (string-prefix-p "2" status)
- (funcall success)
- (if (string-prefix-p "404" status)
- (message "Error %s: page not found" status)
- (let ((json-response (with-current-buffer response
- (fedi-http--process-json))))
- (message "Error %s: %s" status (alist-get 'error json-response)))))))
+ (cond ((string-prefix-p "2" status)
+ (funcall success))
+ ((string-prefix-p "404" status)
+ (message "Error %s: page not found" status))
+ (t
+ (let ((json-response (with-current-buffer response
+ (fedi-http--process-json))))
+ (user-error "Error %s: %s" status
+ (alist-get 'error json-response)))))))
(defun fedi-http--read-file-as-string (filename)
"Read a file FILENAME as a string. Used to generate image preview."