aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-10-22 22:07:22 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-10-22 22:07:22 +0000
commit1d20f5812f00a7c5f27cc07d9669723ee8a5a9e4 (patch)
treefaf2572f7f0b1ddcf8ab965880165ba7bda0393a
parentaa91a3f2148558e1b4aef775484bacd72cd00011 (diff)
downloadpaludis-1d20f5812f00a7c5f27cc07d9669723ee8a5a9e4.tar.gz
paludis-1d20f5812f00a7c5f27cc07d9669723ee8a5a9e4.tar.xz
Introduce NoSuchSetError and RecursivelyDefinedSetError and use them.
-rw-r--r--paludis/dep_list.cc4
-rw-r--r--paludis/repository-fwd.hh3
-rw-r--r--paludis/repository.cc12
-rw-r--r--paludis/repository.hh68
4 files changed, 85 insertions, 2 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index a55d7f1..26d6e21 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -595,12 +595,12 @@ DepList::AddVisitor::visit_leaf(const NamedSetDepSpec & a)
tr1::shared_ptr<const SetSpecTree::ConstItem> set(d->_imp->env->set(a.name()));
if (! set)
- throw NoSuchPackageError(stringify(a.name()));
+ throw NoSuchSetError(stringify(a.name()));
if (! recursing_sets.insert(a.name()).second)
{
Log::get_instance()->message(ll_warning, lc_context) << "Recursively defined set '" << a.name() << "'";
- throw NoSuchPackageError(stringify(a.name()));
+ throw RecursivelyDefinedSetError(stringify(a.name()));
}
set->accept(*this);
diff --git a/paludis/repository-fwd.hh b/paludis/repository-fwd.hh
index f04bce8..03fd30f 100644
--- a/paludis/repository-fwd.hh
+++ b/paludis/repository-fwd.hh
@@ -31,6 +31,9 @@
namespace paludis
{
+ class NoSuchSetError;
+ class RecursivelyDefinedSetError;
+
class Environment;
class RepositoryNameCache;
class ERepositoryProfile;
diff --git a/paludis/repository.cc b/paludis/repository.cc
index fae91dd..daf5bdc 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -47,6 +47,18 @@ template class Set<tr1::shared_ptr<Repository> >;
template class Sequence<RepositoryVirtualsEntry>;
template class Sequence<RepositoryProvidesEntry>;
+NoSuchSetError::NoSuchSetError(const std::string & our_name) throw () :
+ Exception("Could not find '" + our_name + "'"),
+ _name(our_name)
+{
+}
+
+RecursivelyDefinedSetError::RecursivelyDefinedSetError(const std::string & our_name) throw () :
+ Exception("Set '" + our_name + "' is recursively defined"),
+ _name(our_name)
+{
+}
+
namespace
{
struct RepositoryBlacklist :
diff --git a/paludis/repository.hh b/paludis/repository.hh
index dfcbde5..e03ddc8 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -51,6 +51,74 @@
namespace paludis
{
+ /**
+ * Thrown if a Set does not exist
+ *
+ * \ingroup g_exceptions
+ * \ingroup g_repository
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE NoSuchSetError :
+ public Exception
+ {
+ private:
+ std::string _name;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ NoSuchSetError(const std::string & name) throw ();
+
+ virtual ~NoSuchSetError() throw ()
+ {
+ }
+
+ ///\}
+
+ /**
+ * Name of the set.
+ */
+ const std::string & name() const
+ {
+ return _name;
+ }
+ };
+
+ /**
+ * Thrown if a Set is recursively defined
+ *
+ * \ingroup g_exceptions
+ * \ingroup g_repository
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE RecursivelyDefinedSetError :
+ public Exception
+ {
+ private:
+ std::string _name;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ RecursivelyDefinedSetError(const std::string & name) throw ();
+
+ virtual ~RecursivelyDefinedSetError() throw ()
+ {
+ }
+
+ ///\}
+
+ /**
+ * Name of the set.
+ */
+ const std::string & name() const
+ {
+ return _name;
+ }
+ };
+
#include <paludis/repository-sr.hh>
/**