diff options
| author | Philip Kaludercic | 2022-11-19 12:19:37 +0100 |
|---|---|---|
| committer | Philip Kaludercic | 2022-11-19 14:07:09 +0100 |
| commit | 00aebdc182015614e215885e72a06f6df03e57d2 (patch) | |
| tree | 9405e1db99a9ca42e450b06c2302cfb2e536578e | |
| parent | 9ad3fce4a5c902a2c23b0ef2e7a8a5cae5cc3876 (diff) | |
| download | emacs-00aebdc182015614e215885e72a06f6df03e57d2.tar.gz emacs-00aebdc182015614e215885e72a06f6df03e57d2.zip | |
* lisp/emacs-lisp/package.el (package-maintainers): Improve error handling
| -rw-r--r-- | lisp/emacs-lisp/package.el | 17 |
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. |
| 4537 | The email address may contain commas, if there are multiple | 4540 | The email address may contain commas, if there are multiple |
| 4538 | maintainers. If no maintainers are found, an error will be | 4541 | maintainers. If no maintainers are found, an error will be |
| 4539 | signaled. If the optional argument NO-ERROR is non-nil no error | 4542 | signaled. If the optional argument NO-ERROR is non-nil no error |
| 4540 | will be signaled in that case." | 4543 | will 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) |