Use user-error rather than ‘error’ in interactive functions

This commit is contained in:
Milan Zamazal 2022-07-25 20:58:07 +02:00
parent 8109f43855
commit 115a8a89a3

View File

@ -157,7 +157,7 @@ The indicator is displayed only on graphical terminals."
(interactive) (interactive)
(when (and (not (eq major-mode 'pipewire-mode)) (when (and (not (eq major-mode 'pipewire-mode))
(not (equal (buffer-name) pipewire-buffer))) (not (equal (buffer-name) pipewire-buffer)))
(error "Not in a PipeWire buffer")) (user-error "Not in a PipeWire buffer"))
(pipewire-lib-refresh) (pipewire-lib-refresh)
(let ((inhibit-read-only t) (let ((inhibit-read-only t)
(default-ids (mapcar #'cdr (pipewire-lib-default-nodes))) (default-ids (mapcar #'cdr (pipewire-lib-default-nodes)))
@ -297,7 +297,7 @@ object. Otherwise apply it on the default audio sink."
(let ((object (car (pipewire-lib-default-capture-ports)))) (let ((object (car (pipewire-lib-default-capture-ports))))
(if object (if object
(pipewire--update-muted object (pipewire-lib-toggle-mute object)) (pipewire--update-muted object (pipewire-lib-toggle-mute object))
(error "No default audio input")))) (user-error "No default audio input"))))
;;;###autoload ;;;###autoload
(defun pipewire-set-volume (volume &optional object single-p) (defun pipewire-set-volume (volume &optional object single-p)
@ -392,7 +392,7 @@ Otherwise ask for the Node to set as the default Node."
;; Without this, ports of the device may not be displayed on the update: ;; Without this, ports of the device may not be displayed on the update:
(sit-for 0) (sit-for 0)
(pipewire--update)) (pipewire--update))
(error "Nothing to set a profile for here"))) (user-error "Nothing to set a profile for here")))
(defun pipewire-properties () (defun pipewire-properties ()
"Display properties of the object at the current point." "Display properties of the object at the current point."
@ -406,7 +406,7 @@ Otherwise ask for the Node to set as the default Node."
(insert (format "%s: %s\n" p (pipewire-lib-object-value object p))))) (insert (format "%s: %s\n" p (pipewire-lib-object-value object p)))))
(goto-char (point-min)) (goto-char (point-min))
(view-mode)) (view-mode))
(error "No PipeWire object here"))) (user-error "No PipeWire object here")))
(defvar pipewire-mode-map (defvar pipewire-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))