aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-01 20:17:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-01 20:17:48 +0000
commit55a0c895ea5276418d2e9ea28ff1684acbb506dc (patch)
treed0747fdc44018910f3cc4614ea6be68523a8885d
parent4c910c017c53ba1212be1961f666a8f90dcb3ab6 (diff)
downloadpaludis-55a0c895ea5276418d2e9ea28ff1684acbb506dc.tar.gz
paludis-55a0c895ea5276418d2e9ea28ff1684acbb506dc.tar.xz
Make more data available for NoSuchRepositoryError
-rw-r--r--paludis/package_database.cc25
-rw-r--r--paludis/package_database.hh16
2 files changed, 36 insertions, 5 deletions
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 92ada0c..d7db1ed 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -66,11 +66,28 @@ NoSuchPackageError::NoSuchPackageError(const std::string & our_name) throw () :
{
}
-NoSuchRepositoryError::NoSuchRepositoryError(const std::string & name) throw () :
- PackageDatabaseLookupError("Could not find repository '" + name + "'")
+NoSuchRepositoryError::NoSuchRepositoryError(const std::string & n) throw () :
+ PackageDatabaseLookupError("Could not find repository '" + n + "'"),
+ _name("UNKNOWN")
{
}
+NoSuchRepositoryError::NoSuchRepositoryError(const RepositoryName & n) throw () :
+ PackageDatabaseLookupError("Could not find repository '" + stringify(n) + "'"),
+ _name(n)
+{
+}
+
+NoSuchRepositoryError::~NoSuchRepositoryError() throw ()
+{
+}
+
+RepositoryName
+NoSuchRepositoryError::name() const
+{
+ return _name;
+}
+
/**
* Name data for an AmbiguousPackageNameError.
*
@@ -340,7 +357,7 @@ PackageDatabase::fetch_repository(const RepositoryName & n) const
if ((*r)->name() == n)
return *r;
- throw NoSuchRepositoryError(stringify(n));
+ throw NoSuchRepositoryError(n);
}
std::tr1::shared_ptr<Repository>
@@ -351,7 +368,7 @@ PackageDatabase::fetch_repository(const RepositoryName & n)
if ((*r)->name() == n)
return *r;
- throw NoSuchRepositoryError(stringify(n));
+ throw NoSuchRepositoryError(n);
}
bool
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index 5eab072..79f485e 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -189,11 +189,25 @@ namespace paludis
*/
class PALUDIS_VISIBLE NoSuchRepositoryError : public PackageDatabaseLookupError
{
+ private:
+ const RepositoryName _name;
+
public:
/**
* Constructor.
+ *
+ * \deprecated Use the RepositoryName form.
*/
- NoSuchRepositoryError(const std::string & name) throw ();
+ NoSuchRepositoryError(const std::string &) throw () PALUDIS_ATTRIBUTE((deprecated));
+
+ /**
+ * Constructor.
+ */
+ NoSuchRepositoryError(const RepositoryName &) throw ();
+
+ ~NoSuchRepositoryError() throw ();
+
+ RepositoryName name() const;
};
/**