12#ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSORERROR_HPP
13#define RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSORERROR_HPP
15#include "llnetio/mudpi/mudpi.hpp"
19#include <system_error>
22#include <fmt/format.h>
23#include <fmt/ostream.h>
27template <
class ErrorStruct>
39 return m_error_info.has_value();
44 return HasError()
and std::holds_alternative<E>(*m_error_info);
50 throw std::logic_error(
"bad error access");
52 return std::get<E>(*m_error_info);
57 throw std::logic_error(
"bad error access");
60 std::visit([&](
auto&&
arg) {
msg =
arg.What(); }, *m_error_info);
65 std::optional<typename ErrorStruct::VariantType> m_error_info;
82 inline std::string
What()
const {
84 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2}. FrameId out of "
103 inline std::string
What()
const {
105 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2} Expected SampleId "
106 "{}. Unexpected SampleId, frame rejected.",
124 inline std::string
What()
const {
126 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2} Expected FrameId "
127 "{:2}. Unexpected FrameId, frame rejected.",
144 inline std::string
What()
const {
146 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2}. Synchronising: "
163 inline std::string
What()
const {
165 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {}. Wrangler Error: {}",
184 inline std::string
What()
const {
186 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2}. Packet Size "
187 "mismatch: actual size {} expected size {}",
208 inline std::string
What()
const {
210 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2}. Wrong MUDPI "
211 "Checksum: {} should be: {}",
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
Definition ddsPubThread.cpp:17
Definition mudpiProcessingError.hpp:28
ErrorCode(typename ErrorStruct::VariantType err)
Definition mudpiProcessingError.hpp:35
bool HasError() const
Definition mudpiProcessingError.hpp:43
E GetError() const
Definition mudpiProcessingError.hpp:48
bool HasError() const
Definition mudpiProcessingError.hpp:38
std::string What() const
Definition mudpiProcessingError.hpp:55
MUDPI Checksum error.
Definition mudpiProcessingError.hpp:201
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:203
std::string_view dds_topic
Definition mudpiProcessingError.hpp:202
std::string What() const
Definition mudpiProcessingError.hpp:208
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:204
uint16_t actual_checksum
Definition mudpiProcessingError.hpp:206
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:205
uint16_t expected_checksum
Definition mudpiProcessingError.hpp:207
FrameId out of range.
Definition mudpiProcessingError.hpp:76
std::string_view dds_topic
Definition mudpiProcessingError.hpp:77
std::string What() const
Definition mudpiProcessingError.hpp:82
llnetio::mudpi::NumFrames num_frames
Definition mudpiProcessingError.hpp:81
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:79
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:80
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:78
(UDP) Packet Size error.
Definition mudpiProcessingError.hpp:177
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:180
std::string What() const
Definition mudpiProcessingError.hpp:184
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:181
std::string_view dds_topic
Definition mudpiProcessingError.hpp:178
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:179
size_t expected_packet_size
Definition mudpiProcessingError.hpp:183
size_t actual_packet_size
Definition mudpiProcessingError.hpp:182
Synchronising.
Definition mudpiProcessingError.hpp:139
std::string What() const
Definition mudpiProcessingError.hpp:144
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:143
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:141
std::string_view dds_topic
Definition mudpiProcessingError.hpp:140
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:142
unexpected frame id inside a sample
Definition mudpiProcessingError.hpp:118
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:122
std::string_view dds_topic
Definition mudpiProcessingError.hpp:119
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:121
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:120
llnetio::mudpi::FrameId expected_frame_id
Definition mudpiProcessingError.hpp:123
std::string What() const
Definition mudpiProcessingError.hpp:124
unexpected sample id, so we need to resynchronize
Definition mudpiProcessingError.hpp:97
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:101
llnetio::mudpi::SampleId expected_sample_id
Definition mudpiProcessingError.hpp:102
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:100
std::string_view dds_topic
Definition mudpiProcessingError.hpp:98
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:99
std::string What() const
Definition mudpiProcessingError.hpp:103
Wrangler Error.
Definition mudpiProcessingError.hpp:158
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:160
std::string_view dds_topic
Definition mudpiProcessingError.hpp:159
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:161
std::error_code error
Definition mudpiProcessingError.hpp:162
std::string What() const
Definition mudpiProcessingError.hpp:163
MUDPI Processor errors.
Definition mudpiProcessingError.hpp:72
std::variant< FrameIdOutOfRange, UnexpectedSampleId, UnexpectedFrameId, Synchronising, WranglerError, PacketSizeError, ChecksumError > VariantType
Definition mudpiProcessingError.hpp:221