mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-26 04:57:40 +00:00
Better exception handling for File_Signal_Source
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@214 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
@@ -108,11 +108,11 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
|||||||
<< std::endl
|
<< std::endl
|
||||||
<< "or specify your own receiver and source with the flag"
|
<< "or specify your own receiver and source with the flag"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<<"gnss-sdr --config_file=my_GNSS_SDR_configuration"
|
<<"gnss-sdr --config_file=my_GNSS_SDR_configuration.conf"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
LOG_AT_LEVEL(INFO) << "file_signal_source: Unable to open the samples file "
|
LOG_AT_LEVEL(INFO) << "file_signal_source: Unable to open the samples file "
|
||||||
<< filename_.c_str() << ", exiting the program.";
|
<< filename_.c_str() << ", exiting the program.";
|
||||||
exit(1);
|
throw(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")";
|
DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")";
|
||||||
|
|||||||
@@ -242,9 +242,19 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
|
|||||||
|
|
||||||
// SIGNAL SOURCES -------------------------------------------------------------
|
// SIGNAL SOURCES -------------------------------------------------------------
|
||||||
else if (implementation.compare("File_Signal_Source") == 0)
|
else if (implementation.compare("File_Signal_Source") == 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
block = new FileSignalSource(configuration, role, in_streams,
|
block = new FileSignalSource(configuration, role, in_streams,
|
||||||
out_streams, queue);
|
out_streams, queue);
|
||||||
|
}
|
||||||
|
catch (const std::exception &e)
|
||||||
|
{
|
||||||
|
std::cout << "GNSS-SDR program ended." << std::endl;
|
||||||
|
LOG_AT_LEVEL(INFO) << implementation
|
||||||
|
<< ": Source file not found";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (implementation.compare("UHD_Signal_Source") == 0)
|
else if (implementation.compare("UHD_Signal_Source") == 0)
|
||||||
|
|||||||
@@ -74,5 +74,5 @@ TEST(FileSignalSource, InstantiateFileNotExists) {
|
|||||||
config->set_property("Test.item_type", "gr_complex");
|
config->set_property("Test.item_type", "gr_complex");
|
||||||
config->set_property("Test.repeat", "false");
|
config->set_property("Test.repeat", "false");
|
||||||
|
|
||||||
EXPECT_THROW(new FileSignalSource(config, "Test", 1, 1, queue), std::runtime_error);
|
EXPECT_THROW(new FileSignalSource(config, "Test", 1, 1, queue), std::exception);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user