summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2022-11-19 12:19:37 +0100
committerPhilip Kaludercic <philipk@posteo.net>2022-11-19 14:07:09 +0100
commit00aebdc182015614e215885e72a06f6df03e57d2 (patch)
tree9405e1db99a9ca42e450b06c2302cfb2e536578e /lisp/emacs-lisp
parent9ad3fce4a5c902a2c23b0ef2e7a8a5cae5cc3876 (diff)
downloademacs-00aebdc182015614e215885e72a06f6df03e57d2.tar.gz
emacs-00aebdc182015614e215885e72a06f6df03e57d2.tar.bz2
emacs-00aebdc182015614e215885e72a06f6df03e57d2.zip
* lisp/emacs-lisp/package.el (package-maintainers): Improve error handling
Diffstat (limited to 'lisp/emacs-lisp')
-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."
(funcall browse-url-secondary-browser-function url)
(browse-url url))))
+(declare-function ietf-drums-parse-address "ietf-drums"
+ (string &optional decode))
+
(defun package-maintainers (pkg-desc &optional no-error)
"Return an email address for the maintainers of PKG-DESC.
The email address may contain commas, if there are multiple
maintainers. If no maintainers are found, an error will be
signaled. If the optional argument NO-ERROR is non-nil no error
will be signaled in that case."
- (unless pkg-desc
- (error "Invalid package description"))
- (let* ((extras (package-desc-extras pkg-desc))
+ (unless (package-desc-p pkg-desc)
+ (error "Invalid package description: %S" pkg-desc))
+ (let* ((name (package-desc-name pkg-desc))
+ (extras (package-desc-extras pkg-desc))
(maint (alist-get :maintainer extras)))
(cond
((and (null maint) (null no-error))
- (user-error "Package has no explicit maintainer"))
+ (user-error "Package `%s' has no explicit maintainer" name))
+ ((and (not (progn
+ (require 'ietf-drums)
+ (ietf-drums-parse-address maint)))
+ (null no-error))
+ (user-error "Package `%s' has no maintainer address" name))
((not (null maint))
(with-temp-buffer
(package--print-email-button maint)