OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-storage commits / bec2bfc

Handle the new TriggerLink correctly
bec2bfc1c34b32f218785accbb59af0e3dd01ac9
by Linas Vepštas <linasvepstas@gmail.com> · 2026-01-21T05:33:59.000Z

Changed files (1) +14 -3

opencog/persist/json/JSCommands.cc +14 -3
……@@ -23,6 +23,7 @@
2323#include <opencog/atoms/atom_types/NameServer.h>
2424#include <opencog/atoms/base/Link.h>
2525#include <opencog/atoms/base/Node.h>
26#include <opencog/atoms/parallel/TriggerLink.h>
2627#include <opencog/atoms/value/FloatValue.h>
2728#include <opencog/atomspace/AtomSpace.h>
2829#include <opencog/atomspace/version.h>
……@@ -569,9 +570,19 @@ std::string JSCommands::interpret_command(AtomSpace* as,
569570 // { "type": "NumberNode", "name": "2" }] })
570571 if (execu == act)
571572 {
572 ADD_ATOM;
573
574 ValuePtr vp = h->execute();
573 // try..catch is needed because the Atom might be a TriggerLink
574 // which will force execution, but then throw an exception with
575 // the result of execution in it.
576 ValuePtr vp;
577 try
578 {
579 ADD_ATOM;
580 vp = h->execute();
581 }
582 catch (const ValueReturnException& ex)
583 {
584 vp = ex._value;
585 }
575586 std::string result = js_mode ? Json::encode_value(vp) : Sexpr::encode_value(vp);
576587 RETURNSTR(result);
577588 }