diff --git a/source/RobotAPI/libraries/armem/client/Reader.cpp b/source/RobotAPI/libraries/armem/client/Reader.cpp index fc4775bc3ebf4f202883719aae1de1aa83c5a5a1..72e450c421d85436459065a834dae04a4f1ef433 100644 --- a/source/RobotAPI/libraries/armem/client/Reader.cpp +++ b/source/RobotAPI/libraries/armem/client/Reader.cpp @@ -1,5 +1,7 @@ #include "Reader.h" +#include <sstream> + #include <ArmarXCore/core/logging/Logging.h> #include "query/Builder.h" @@ -109,15 +111,27 @@ namespace armarx::armem::client void Reader::updated(const std::vector<MemoryID>& updatedSnapshotIDs) const { + std::stringstream error; + for (const auto& [subscription, callbacks] : this->callbacks) { std::vector<MemoryID> matchingSnapshotIDs; for (const MemoryID& updatedSnapshotID : updatedSnapshotIDs) { - if (contains(subscription, updatedSnapshotID)) + try + { + if (contains(subscription, updatedSnapshotID)) + { + matchingSnapshotIDs.push_back(updatedSnapshotID); + } + } + catch (const armem::error::InvalidMemoryID& e) { - matchingSnapshotIDs.push_back(updatedSnapshotID); + // Log to debug, but ignore otherwise + error << "Error when comparing subscribed ID " << subscription + << " with updated ID " << updatedSnapshotID << ":\n" + << e.what() << "\n\n"; } } @@ -129,6 +143,11 @@ namespace armarx::armem::client } } } + if (error.str().size() > 0) + { + ARMARX_VERBOSE << "The following issues were encountered during Reader::" << __FUNCTION__ << "(): \n\n" + << error.str(); + } } data::StoreResult diff --git a/source/RobotAPI/libraries/armem/core/MemoryID.cpp b/source/RobotAPI/libraries/armem/core/MemoryID.cpp index 61dd4836ca9f16ffd6b36342facbd2f610c75ff3..30d1c1aeca74aa75c7e9db7a3ef554d8f88d4387 100644 --- a/source/RobotAPI/libraries/armem/core/MemoryID.cpp +++ b/source/RobotAPI/libraries/armem/core/MemoryID.cpp @@ -418,13 +418,13 @@ namespace armarx::armem if (!general.isWellDefined()) { std::stringstream ss; - ss << "ID `general` is not well-defined, which is required for `" << __FUNCTION__ << "()`."; + ss << "\nGeneral ID " << general << " is not well-defined, which is required for `" << __FUNCTION__ << "()`."; throw error::InvalidMemoryID(general, ss.str()); } if (!specific.isWellDefined()) { std::stringstream ss; - ss << "ID `specific` is not well-defined, which is required for `" << __FUNCTION__ << "()`."; + ss << "\nSpecific ID " << specific << " is not well-defined, which is required for `" << __FUNCTION__ << "()`."; throw error::InvalidMemoryID(specific, ss.str()); }