aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Kaludercic2022-11-19 12:19:37 +0100
committerPhilip Kaludercic2022-11-19 14:07:09 +0100
commit00aebdc182015614e215885e72a06f6df03e57d2 (patch)
tree9405e1db99a9ca42e450b06c2302cfb2e536578e
parent9ad3fce4a5c902a2c23b0ef2e7a8a5cae5cc3876 (diff)
downloademacs-00aebdc182015614e215885e72a06f6df03e57d2.tar.gz
emacs-00aebdc182015614e215885e72a06f6df03e57d2.zip
* lisp/emacs-lisp/package.el (package-maintainers): Improve error handling
-rw-r--r--lisp/emacs-lisp/package.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 2f19573e3cd..c1545a28701 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4532,19 +4532,28 @@ DESC must be a `package-desc' object."
4532 (funcall browse-url-secondary-browser-function url) 4532 (funcall browse-url-secondary-browser-function url)
4533 (browse-url url)))) 4533 (browse-url url))))
4534 4534
4535(declare-function ietf-drums-parse-address "ietf-drums"
4536 (string &optional decode))
4537
4535(defun package-maintainers (pkg-desc &optional no-error) 4538(defun package-maintainers (pkg-desc &optional no-error)
4536 "Return an email address for the maintainers of PKG-DESC. 4539 "Return an email address for the maintainers of PKG-DESC.
4537The email address may contain commas, if there are multiple 4540The email address may contain commas, if there are multiple
4538maintainers. If no maintainers are found, an error will be 4541maintainers. If no maintainers are found, an error will be
4539signaled. If the optional argument NO-ERROR is non-nil no error 4542signaled. If the optional argument NO-ERROR is non-nil no error
4540will be signaled in that case." 4543will be signaled in that case."
4541 (unless pkg-desc 4544 (unless (package-desc-p pkg-desc)
4542 (error "Invalid package description")) 4545 (error "Invalid package description: %S" pkg-desc))
4543 (let* ((extras (package-desc-extras pkg-desc)) 4546 (let* ((name (package-desc-name pkg-desc))
4547 (extras (package-desc-extras pkg-desc))
4544 (maint (alist-get :maintainer extras))) 4548 (maint (alist-get :maintainer extras)))
4545 (cond 4549 (cond
4546 ((and (null maint) (null no-error)) 4550 ((and (null maint) (null no-error))
4547 (user-error "Package has no explicit maintainer")) 4551 (user-error "Package `%s' has no explicit maintainer" name))
4552 ((and (not (progn
4553 (require 'ietf-drums)
4554 (ietf-drums-parse-address maint)))
4555 (null no-error))
4556 (user-error "Package `%s' has no maintainer address" name))
4548 ((not (null maint)) 4557 ((not (null maint))
4549 (with-temp-buffer 4558 (with-temp-buffer
4550 (package--print-email-button maint) 4559 (package--print-email-button maint)