Skip to content

Commit

Permalink
Merge pull request #2880 from linas/add-debug-printing
Browse files Browse the repository at this point in the history
Add debug printing
  • Loading branch information
linas authored Nov 3, 2021
2 parents 8605d0f + 509c589 commit e02336f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
20 changes: 16 additions & 4 deletions opencog/atoms/pattern/MeetLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,22 @@ QueueValuePtr MeetLink::do_execute(AtomSpace* as, bool silent)
{
if (nullptr == as) as = _atom_space;

SatisfyingSet sater(as);
sater.satisfy(PatternLinkCast(get_handle()));

return sater.get_result_queue();
try
{
SatisfyingSet sater(as);
sater.satisfy(PatternLinkCast(get_handle()));
return sater.get_result_queue();
}
catch(const StandardException& ex)
{
std::string msg =
"Exception during pattern execution! Patterns was\n";
msg += to_string();
msg += "\nException was:\n";
msg += ex.get_message();
ex.set_message(msg.c_str());
throw;
}
}

ValuePtr MeetLink::execute(AtomSpace* as, bool silent)
Expand Down
16 changes: 15 additions & 1 deletion opencog/atoms/pattern/QueryLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,21 @@ QueueValuePtr QueryLink::do_execute(AtomSpace* as, bool silent)

Implicator impl(as);
impl.implicand = this->get_implicand();
impl.satisfy(PatternLinkCast(get_handle()));

try
{
impl.satisfy(PatternLinkCast(get_handle()));
}
catch(const StandardException& ex)
{
std::string msg =
"Exception during pattern execution! Patterns was\n";
msg += to_string();
msg += "\nException was:\n";
msg += ex.get_message();
ex.set_message(msg.c_str());
throw;
}

// If we got a non-empty answer, just return it.
QueueValuePtr qv(impl.get_result_queue());
Expand Down
4 changes: 2 additions & 2 deletions opencog/guile/SchemeEval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1129,9 +1129,9 @@ ValuePtr SchemeEval::apply_v(const std::string &func, Handle varargs)
_hargs = nullptr;

if (eval_error())
throw RuntimeException(TRACE_INFO, "Unable to apply %s to\n%s\n%s",
throw RuntimeException(TRACE_INFO, "Unable to apply `%s` to\n%s\n%s",
func.c_str(),
(nullptr == varargs) ? "nullptr" : varargs->to_string().c_str(),
(nullptr == varargs) ? "(nullptr)" : varargs->to_string().c_str(),
_error_msg.c_str());

// We do not want this->_retval to point at anything after we return.
Expand Down

0 comments on commit e02336f

Please sign in to comment.