aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-22 18:28:13 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-22 19:59:40 +0100
commitcd9f4e058252beb02b924867946cb2ce1365177f (patch)
tree24cde6edd38405350b2fa13e809e5bea9b5e8455
parenta556e5401b1bb7024360720673ab2c79c42e2df0 (diff)
downloadpaludis-cd9f4e058252beb02b924867946cb2ce1365177f.tar.gz
paludis-cd9f4e058252beb02b924867946cb2ce1365177f.tar.xz
error rather than barfing
-rw-r--r--paludis/resolver/resolver.cc30
-rw-r--r--paludis/resolver/resolver.hh6
2 files changed, 10 insertions, 26 deletions
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 981c759..a5934b3 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -464,13 +464,14 @@ Resolver::_apply_resolution_constraint(
const std::tr1::shared_ptr<const Constraint> & constraint)
{
if (resolution->decision())
- _verify_new_constraint(qpn_s, resolution, constraint);
+ if (! _verify_new_constraint(qpn_s, resolution, constraint))
+ _made_wrong_decision(qpn_s, resolution, constraint);
resolution->constraints()->add(constraint);
}
-void
-Resolver::_verify_new_constraint(const QPN_S & qpn_s,
+bool
+Resolver::_verify_new_constraint(const QPN_S &,
const std::tr1::shared_ptr<const Resolution> & resolution,
const std::tr1::shared_ptr<const Constraint> & constraint)
{
@@ -517,13 +518,12 @@ Resolver::_verify_new_constraint(const QPN_S & qpn_s,
if (ok && ! constraint->untaken())
ok = resolution->decision()->taken();
- if (! ok)
- _made_wrong_decision(qpn_s, resolution, constraint);
+ return ok;
}
void
Resolver::_made_wrong_decision(const QPN_S & qpn_s,
- const std::tr1::shared_ptr<const Resolution> & resolution,
+ const std::tr1::shared_ptr<Resolution> & resolution,
const std::tr1::shared_ptr<const Constraint> & constraint)
{
/* can we find a resolution that works for all our constraints? */
@@ -534,23 +534,7 @@ Resolver::_made_wrong_decision(const QPN_S & qpn_s,
if (decision)
_suggest_restart_with(qpn_s, resolution, constraint, decision);
else
- {
- std::string old_decision("none");
- if (resolution->decision())
- {
- if (resolution->decision()->if_package_id())
- old_decision = stringify(*resolution->decision()->if_package_id());
- else
- old_decision = stringify(resolution->decision()->kind());
- }
-
- std::stringstream str;
- Serialiser ser(str);
- constraint->serialise(ser);
-
- throw InternalError(PALUDIS_HERE, "unimplemented: made decision " + old_decision +
- ", now can't make one because of " + str.str());
- }
+ resolution->decision() = _cannot_decide_for(qpn_s, adapted_resolution);
}
void
diff --git a/paludis/resolver/resolver.hh b/paludis/resolver/resolver.hh
index dc2ff17..530dd0e 100644
--- a/paludis/resolver/resolver.hh
+++ b/paludis/resolver/resolver.hh
@@ -77,13 +77,13 @@ namespace paludis
const std::tr1::shared_ptr<Resolution> &,
const std::tr1::shared_ptr<const Constraint> &);
- void _verify_new_constraint(const QPN_S &,
+ bool _verify_new_constraint(const QPN_S &,
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const Constraint> &);
void _made_wrong_decision(const QPN_S & qpn_s,
- const std::tr1::shared_ptr<const Resolution> & resolution,
- const std::tr1::shared_ptr<const Constraint> & constraint) PALUDIS_ATTRIBUTE((noreturn));
+ const std::tr1::shared_ptr<Resolution> & resolution,
+ const std::tr1::shared_ptr<const Constraint> & constraint);
void _suggest_restart_with(const QPN_S & qpn_s,
const std::tr1::shared_ptr<const Resolution> & resolution,