1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-22 10:04:52 +00:00

Improve error handling when the flow graph fails to start

Avoid segmentation faults due to some common inconsistencies in the configuration file
E.g.: non-existing names for blocks implementation, some mismatched input/output item sizes

Provide hints to the user on how to fix the configuration in case of failure when starting the flow graph
This commit is contained in:
Carles Fernandez
2021-01-24 01:49:16 +01:00
parent 268fc1215c
commit a21c60ecb2
6 changed files with 283 additions and 127 deletions

View File

@@ -17,6 +17,7 @@
#include "signal_conditioner.h"
#include <glog/logging.h>
#include <stdexcept>
#include <utility>
@@ -40,6 +41,18 @@ void SignalConditioner::connect(gr::top_block_sptr top_block)
LOG(WARNING) << "Signal conditioner already connected internally";
return;
}
if (data_type_adapt_ == nullptr)
{
throw std::invalid_argument("DataTypeAdapter implementation not defined");
}
if (in_filt_ == nullptr)
{
throw std::invalid_argument("InputFilter implementation not defined");
}
if (res_ == nullptr)
{
throw std::invalid_argument("Resampler implementation not defined");
}
data_type_adapt_->connect(top_block);
in_filt_->connect(top_block);
res_->connect(top_block);