aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-22 23:12:10 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-22 23:12:10 +0000
commit3d785bd62aa8569945b651bd63564ea93c764df4 (patch)
tree7be1a651978901f607c4b90acfb86b3553e2beaf
parentb19bca4123308158bf6ae59887c9b1ec41179701 (diff)
downloadpaludis-3d785bd62aa8569945b651bd63564ea93c764df4.tar.gz
paludis-3d785bd62aa8569945b651bd63564ea93c764df4.tar.xz
Improve error condition handling
-rw-r--r--paludis/vdb_repository.cc12
-rw-r--r--paludis/vdb_repository.hh15
2 files changed, 23 insertions, 4 deletions
diff --git a/paludis/vdb_repository.cc b/paludis/vdb_repository.cc
index 286021f..e1fa20c 100644
--- a/paludis/vdb_repository.cc
+++ b/paludis/vdb_repository.cc
@@ -292,8 +292,7 @@ namespace
std::ifstream ff(stringify(f / key).c_str());
if (! ff)
- throw InternalError(PALUDIS_HERE, "TODO reading " + stringify(location) + " name " +
- stringify(name) + " version " + stringify(v) + " key " + key); /// \todo
+ throw VDBRepositoryKeyReadError("Could not read '" + stringify(f / key) + "'");
return strip_leading(strip_trailing(std::string((std::istreambuf_iterator<char>(ff)),
std::istreambuf_iterator<char>()), " \t\n"), " \t\n");
}
@@ -531,8 +530,7 @@ VDBRepository::do_contents(
std::ifstream ff(stringify(f / "CONTENTS").c_str());
if (! ff)
- throw InternalError(PALUDIS_HERE, "TODO reading " + stringify(_imp->location) + " name " +
- stringify(c + p) + " version " + stringify(v) + " CONTENTS"); /// \todo
+ throw VDBRepositoryKeyReadError("Could not read '" + stringify(f / "CONTENTS") + "'");
std::string line;
unsigned line_number(0);
@@ -668,6 +666,12 @@ VDBRepositoryConfigurationError::VDBRepositoryConfigurationError(
{
}
+VDBRepositoryKeyReadError::VDBRepositoryKeyReadError(
+ const std::string & msg) throw () :
+ ConfigurationError("VDB repository key read error: " + msg)
+{
+}
+
bool
VDBRepository::do_is_arch_flag(const UseFlagName &) const
{
diff --git a/paludis/vdb_repository.hh b/paludis/vdb_repository.hh
index 9bcbcd9..dd82ba3 100644
--- a/paludis/vdb_repository.hh
+++ b/paludis/vdb_repository.hh
@@ -194,6 +194,21 @@ namespace paludis
};
/**
+ * Thrown if a key read fails.
+ *
+ * \ingroup grpvdbrepository
+ * \ingroup grpexceptions
+ */
+ class VDBRepositoryKeyReadError : public ConfigurationError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ VDBRepositoryKeyReadError(const std::string & msg) throw ();
+ };
+
+ /**
* Register the VDB repository format.
*
* \ingroup grpvdbrepository