diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-profile.el | 6 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 13 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 12 | ||||
-rw-r--r-- | lisp/mastodon-views.el | 6 |
4 files changed, 19 insertions, 18 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 3d27bb4..365e352 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -165,7 +165,7 @@ NO-REBLOGS means do not display boosts in statuses." (interactive) (if mastodon-profile--account (mastodon-profile--make-author-buffer mastodon-profile--account :no-reblogs) - (error "Not in a mastodon profile"))) + (user-error "Not in a mastodon profile"))) (defun mastodon-profile--open-following () "Open a profile buffer showing the accounts that current profile follows." @@ -177,7 +177,7 @@ NO-REBLOGS means do not display boosts in statuses." #'mastodon-profile--format-user nil :headers) - (error "Not in a mastodon profile"))) + (user-error "Not in a mastodon profile"))) (defun mastodon-profile--open-followers () "Open a profile buffer showing the accounts following the current profile." @@ -189,7 +189,7 @@ NO-REBLOGS means do not display boosts in statuses." #'mastodon-profile--format-user nil :headers) - (error "Not in a mastodon profile"))) + (user-error "Not in a mastodon profile"))) (defun mastodon-profile--view-favourites () "Open a new buffer displaying the user's favourites." diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 03d5ef8..b0c121a 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1496,8 +1496,9 @@ If NO-ERROR is non-nil, do not error when property is empty." (if no-error (plist-get mastodon-tl--buffer-spec property) (or (plist-get mastodon-tl--buffer-spec property) - (error "Mastodon-tl--buffer-spec is not defined for buffer %s" - (or buffer (current-buffer))))))) + (error "Mastodon-tl--buffer-spec not defined for buffer %s, prop %s" + (or buffer (current-buffer)) + property))))) (defun mastodon-tl--set-buffer-spec (buffer endpoint update-fun &optional link-header update-params hide-replies) @@ -1752,7 +1753,7 @@ ID is that of the toot to view." (toot (mastodon-http--get-json (mastodon-http--api (concat "statuses/" id))))) (if (equal (caar toot) 'error) - (message "Error: %s" (cdar toot)) + (user-error "Error: %s" (cdar toot)) (with-mastodon-buffer buffer #'mastodon-mode nil (mastodon-tl--set-buffer-spec buffer (format "statuses/%s" id) #'mastodon-tl--update-toot) @@ -1772,7 +1773,7 @@ are displayed by default. Call this if you subsequently want to view all branches of a thread." (interactive) (if (not (eq (mastodon-tl--get-buffer-type) 'thread)) - (error "You need to be viewing a thread to call this") + (user-error "You need to be viewing a thread to call this") (goto-char (point-min)) (let ((id (mastodon-tl--property 'base-toot-id))) (mastodon-tl--thread id)))) @@ -1784,7 +1785,7 @@ view all branches of a thread." (type (mastodon-tl--field 'type (mastodon-tl--property 'toot-json :no-move)))) (if (or (string= type "follow_request") (string= type "follow")) ; no can thread these - (error "No thread") + (user-error "No thread") (let* ((endpoint (format "statuses/%s/context" id)) (url (mastodon-http--api endpoint)) (buffer (format "*mastodon-thread-%s*" id)) @@ -1793,7 +1794,7 @@ view all branches of a thread." nil :silent)) (context (mastodon-http--get-json url nil :silent))) (if (equal (caar toot) 'error) - (message "Error: %s" (cdar toot)) + (user-error "Error: %s" (cdar toot)) (when (member (alist-get 'type toot) '("reblog" "favourite")) (setq toot (alist-get 'status toot))) (if (> (+ (length (alist-get 'ancestors context)) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index acedcfe..51e0458 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -376,13 +376,13 @@ TYPE is a symbol, either `favourite' or `boost.'" ;; this boosts/faves the base toot, not the notif status ((and (equal "reblog" toot-type) (not (mastodon-tl--buffer-type-eq 'notifications))) - (error "You can't %s boosts" action-string)) + (user-error "You can't %s boosts" action-string)) ((and (equal "favourite" toot-type) (not (mastodon-tl--buffer-type-eq 'notifications))) - (error "You can't %s favourites" action-string)) + (user-error "You can't %s favourites" action-string)) ((and (equal "private" visibility) (equal type 'boost)) - (error "You can't boost private toots")) + (user-error "You can't boost private toots")) (t (mastodon-toot--action action @@ -491,11 +491,11 @@ With FAVOURITE, list favouriters, else list boosters." (params '(("limit" . "80"))) (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)) + (user-error "%s (Status does not exist or is private)" (alist-get 'error json)) (let ((handles (mastodon-tl--map-alist 'acct json)) (type-string (if favourite "Favouriters" "Boosters"))) (if (not handles) - (error "Looks like this toot has no %s" type-string) + (user-error "Looks like this toot has no %s" type-string) (let ((choice (completing-read (format "%s (enter to view profile): " type-string) handles @@ -1251,7 +1251,7 @@ INSTANCE is JSON." MAX is the maximum number set by their instance." (let ((number (read-number (format "Number of options [2-%s]: " max) 2))) (if (> number max) - (error "You need to choose a number between 2 and %s" max) + (user-error "You need to choose a number between 2 and %s" max) number))) (defun mastodon-toot--create-poll () diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index e348cae..fc2e2d1 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -629,14 +629,14 @@ Prompt for a context, must be a list containting at least one of \"home\", nil nil (or (current-word) ""))) (contexts (if (string-empty-p word) - (error "You must select at least one word for a filter") + (user-error "You must select at least one word for a filter") (completing-read-multiple "Contexts to filter [TAB for options]: " '("home" "notifications" "public" "thread") nil t))) (contexts-processed (if (equal nil contexts) - (error "You must select at least one context for a filter") + (user-error "You must select at least one context for a filter") (mapcar (lambda (x) (cons "context[]" x)) contexts))) @@ -656,7 +656,7 @@ Prompt for a context, must be a list containting at least one of \"home\", (phrase (mastodon-tl--property 'phrase :no-move)) (url (mastodon-http--api (format "filters/%s" filter-id)))) (if (null phrase) - (error "No filter at point?") + (user-error "No filter at point?") (when (y-or-n-p (format "Delete filter %s? " phrase)) (let ((response (mastodon-http--delete url))) (mastodon-http--triage |