richardphibel / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone
00273d
From b636af779fcdab326eef7bbb74912254c2fa2b0c Mon Sep 17 00:00:00 2001
00273d
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
00273d
Date: Thu, 17 Mar 2022 10:34:24 +0100
00273d
Subject: [PATCH 32/34] Add more specific error handling for loading repomd and
00273d
 primary
00273d
00273d
---
00273d
 libdnf/dnf-sack.cpp | 19 +++++++++++++++----
00273d
 1 file changed, 15 insertions(+), 4 deletions(-)
00273d
00273d
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
00273d
index 61f4807c..8e11b8f8 100644
00273d
--- a/libdnf/dnf-sack.cpp
00273d
+++ b/libdnf/dnf-sack.cpp
00273d
@@ -780,13 +780,24 @@ load_yum_repo(DnfSack *sack, HyRepo hrepo, GError **error)
00273d
         fp_primary = solv_xfopen(primary.c_str(), "r");
00273d
         assert(fp_primary);
00273d
 
00273d
-        g_debug("fetching %s", name);
00273d
-        if (repo_add_repomdxml(repo, fp_repomd, 0) || \
00273d
-            repo_add_rpmmd(repo, fp_primary, 0, 0)) {
00273d
+        g_debug("Loading repomd: %s", fn_repomd);
00273d
+        if (repo_add_repomdxml(repo, fp_repomd, 0)) {
00273d
             g_set_error (error,
00273d
                          DNF_ERROR,
00273d
                          DNF_ERROR_INTERNAL_ERROR,
00273d
-                         _("repo_add_repomdxml/rpmmd() has failed."));
00273d
+                         _("Loading repomd has failed: %s"),
00273d
+                         pool_errstr(repo->pool));
00273d
+            retval = FALSE;
00273d
+            goto out;
00273d
+        }
00273d
+
00273d
+        g_debug("Loading primary: %s", primary.c_str());
00273d
+        if (repo_add_rpmmd(repo, fp_primary, 0, 0)) {
00273d
+            g_set_error (error,
00273d
+                         DNF_ERROR,
00273d
+                         DNF_ERROR_INTERNAL_ERROR,
00273d
+                         _("Loading primary has failed: %s"),
00273d
+                         pool_errstr(repo->pool));
00273d
             retval = FALSE;
00273d
             goto out;
00273d
         }
00273d
-- 
00273d
2.31.1
00273d