git: be9243409d6b - main - pkg: improve error message

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 07 Oct 2024 17:05:35 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=be9243409d6be99f5d7815b6d074a85a6e84f7ce

commit be9243409d6be99f5d7815b6d074a85a6e84f7ce
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-10-07 16:33:12 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-10-07 17:05:07 +0000

    pkg: improve error message
    
    Print the complete list of url that have failed
    
    PR:             281924
    Co-authored-by: Baptiste Daroussin <bapt@FreeBSD.org>
    Differential Revision: https://reviews.freebsd.org/D46983
---
 usr.sbin/pkg/pkg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index cc23ffb8c257..6138ca37e439 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -855,7 +855,11 @@ bootstrap_pkg(bool force, const char *fetchOpts)
 	goto cleanup;
 
 fetchfail:
-	warnx("Error fetching %s: %s", url, fetchLastErrString);
+	for (int j = 0; bootstrap_names[j] != NULL; j++) {
+		warnx("Attempted to fetch %s/Latest/%s", packagesite,
+		    bootstrap_names[j]);
+	}
+	warnx("Error: %s", fetchLastErrString);
 	if (fetchLastErrCode == FETCH_RESOLV) {
 		fprintf(stderr, "Address resolution failed for %s.\n", packagesite);
 		fprintf(stderr, "Consider changing PACKAGESITE.\n");