aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-01-15 12:49:50 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-01-15 12:50:00 +0000
commit7ab91ff320b8ad27ebb7fc2b6944d738f8ff9b51 (patch)
treea742f1c432d6b14c335a813ad87143a3f351078b
parent95bd57bb886a5673bd690760b0041f70e1c11b11 (diff)
downloadpaludis-7ab91ff320b8ad27ebb7fc2b6944d738f8ff9b51.tar.gz
paludis-7ab91ff320b8ad27ebb7fc2b6944d738f8ff9b51.tar.xz
Tweak error for match not finding its ID
-rw-r--r--src/clients/cave/cmd_match.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 0acc14c..129f6d4 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -33,6 +33,7 @@
#include <paludis/util/singleton-impl.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/log.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
@@ -413,8 +414,18 @@ MatchCommand::run_hosted(
const std::shared_ptr<const Set<std::string> > & patterns,
const PackageDepSpec & spec)
{
- const std::shared_ptr<const PackageID> id(*((*env)[selection::RequireExactlyOne(
- generator::Matches(spec, make_null_shared_ptr(), { }))])->begin());
+ std::shared_ptr<const PackageID> id;
+ try
+ {
+ id = (*((*env)[selection::RequireExactlyOne(generator::Matches(spec, make_null_shared_ptr(), { }))])->begin());
+ }
+ catch (const DidNotGetExactlyOneError & e)
+ {
+ Log::get_instance()->message("cave.match.not_one_id", ll_warning, lc_context)
+ << "Got exception '" << e.message() << "' (" << e.what() << ") when looking for '"
+ << spec << "'. This might be caused by a stale search index.";
+ return false;
+ }
std::list<std::string> texts;