branch: elpa/mastodon commit d28b023f39e312f4d430fe57682840ec5147936d Author: marty hiatt <martianhia...@disroot.org> Commit: marty hiatt <martianhia...@disroot.org>
amend/rename mastodon-http--get-cb-data --- lisp/mastodon-http.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index 88f290c2ab..a55097dff2 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -352,24 +352,24 @@ Authorization header is included by default unless UNAUTHENTICED-P is non-nil." (with-temp-buffer (url-retrieve url callback cbargs))))) -(defun mastodon-http--get-data (status) - "Return data using `json-read' after a successful request. -If STATUS includes an error emit a message describing it and return nil." +(defun mastodon-http--get-cb-data (status) + "Return data using `json-read' after a successful async request. +If STATUS includes an error, emit a message describing it and return nil." (let* ((buf (current-buffer)) (data (with-temp-buffer (url-insert buf) (goto-char (point-min)) (json-read)))) (if-let* ((error-thrown (plist-get status :error))) - (prog1 nil - (message "%S %s" error-thrown (alist-get 'error data))) + ;; not necessarily a user error, but we want its functionality: + (user-error "%S %s" error-thrown (alist-get 'error data)) data))) (defun mastodon-http--post-media-callback (status file caption buffer) "Callback function called after posting FILE as an attachment with CAPTION. The toot is being composed in BUFFER. See `url-retrieve' for STATUS." (unwind-protect - (when-let* ((data (mastodon-http--get-data status))) + (when-let* ((data (mastodon-http--get-cb-data status))) (with-current-buffer buffer (let ((id (alist-get 'id data))) ;; update ids: