If ASYNC is non-nil, and if it is possible, run BODY
asynchronously. If an error is encountered and ASYNC is a
function, call it with no arguments (instead of executing BODY).
-The error is propagated either way.
+If it returns non-nil, or if it wasn't a function, propagate the
+error.
For a description of the other arguments see
`package--with-work-buffer'."
(url-retrieve (concat ,location-1 ,file-1)
(lambda (status)
(if-let ((er (plist-get status :error)))
- (progn (if (functionp ,async-1)
- (funcall ,async-1))
- (signal (car er) (cdr er)))
+ (when (if (functionp ,async-1)
+ (funcall ,async-1)
+ t)
+ (message "Error contacting: %s" (concat ,location-1 ,file-1))
+ (signal (car er) (cdr er)))
(goto-char (point-min))
(unless (search-forward "\n\n" nil 'noerror)
(error "Invalid url response in buffer %s"
'silent)
(error (when (functionp ,async-1)
(funcall ,async-1))
+ (message "Error contacting: %s" (concat ,location-1 ,file-1))
(signal (car error-signal) (cdr error-signal)))))))
(defun package--check-signature-content (content string &optional sig-file)
(when good-sigs
(write-region (mapconcat #'epg-signature-to-string good-sigs "\n")
nil (concat local-file ".signed") nil 'silent))
- (package--update-downloads-in-progress archive))))))))
+ (package--update-downloads-in-progress archive)
+ ;; If we got this far, either everything worked or we don't mind
+ ;; not signing, so tell `package--with-work-buffer-async' to not
+ ;; propagate errors.
+ nil)))))))
(defun package--download-and-read-archives (&optional async)
"Download descriptions of all `package-archives' and read them.
archive "archive-contents"
;; Called if the async download fails
(when async
- (lambda () (package--update-downloads-in-progress archive))))
+ ;; The t at the end means to propagate connection errors.
+ (lambda () (package--update-downloads-in-progress archive) t)))
(error (message "Failed to download `%s' archive."
(car archive))))))