Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug printing #2880

Merged
merged 2 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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