diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index 2498453e..81017a22 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -94,6 +94,7 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain * @brief Create a writer object * * Depending on the Topic QoS creates a Basic or Specific Writer. + * If it fails to create the writer it will return a blank one. */ DDSPIPE_PARTICIPANTS_DllAPI std::shared_ptr create_writer( @@ -103,6 +104,7 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain * @brief Create a reader object * * Depending on the Topic QoS creates a Basic or Specific Reader. + * If it fails to create the reader it will return a blank one. */ DDSPIPE_PARTICIPANTS_DllAPI std::shared_ptr create_reader( diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index a4b9b495..7ce4d1cc 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -254,8 +254,20 @@ std::shared_ptr CommonParticipant::create_writer( return std::make_shared(); } - // Get the DDS Topic associated (create it if it does not exist) - fastdds::dds::Topic* fastdds_topic = topic_related_(dds_topic); + fastdds::dds::Topic* fastdds_topic; + try + { + // Get the DDS Topic associated (create it if it does not exist) + fastdds_topic = topic_related_(dds_topic); + } + catch (const utils::InitializationException& e) + { + EPROSIMA_LOG_WARNING( + DDSPIPE_DDS_PARTICIPANT, + e.what() + << " Execution continue but this topic will not be published in Participant " << id() << "."); + return std::make_shared(); + } if (dds_topic.topic_qos.has_partitions() || dds_topic.topic_qos.has_ownership()) { @@ -303,7 +315,20 @@ std::shared_ptr CommonParticipant::create_reader( } // Get the DDS Topic associated (create it if it does not exist) - fastdds::dds::Topic* fastdds_topic = topic_related_(dds_topic); + fastdds::dds::Topic* fastdds_topic; + try + { + // Get the DDS Topic associated (create it if it does not exist) + fastdds_topic = topic_related_(dds_topic); + } + catch (const utils::InitializationException& e) + { + EPROSIMA_LOG_WARNING( + DDSPIPE_DDS_PARTICIPANT, + e.what() + << ". Execution continue but this topic will not be subscribed in Participant " << id() << "."); + return std::make_shared(); + } if (dds_topic.topic_qos.has_partitions() || dds_topic.topic_qos.has_ownership()) {