1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-18 11:09:56 +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:
Carles Fernandez 2012-07-15 11:08:10 +00:00
parent e503ab9e0b
commit 5ff5e8e7bd
3 changed files with 14 additions and 4 deletions

View File

@ -108,11 +108,11 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
<< std::endl
<< "or specify your own receiver and source with the flag"
<< std::endl
<<"gnss-sdr --config_file=my_GNSS_SDR_configuration"
<<"gnss-sdr --config_file=my_GNSS_SDR_configuration.conf"
<< std::endl;
LOG_AT_LEVEL(INFO) << "file_signal_source: Unable to open the samples file "
<< filename_.c_str() << ", exiting the program.";
exit(1);
throw(e);
}
DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")";

View File

@ -242,9 +242,19 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
// SIGNAL SOURCES -------------------------------------------------------------
else if (implementation.compare("File_Signal_Source") == 0)
{
try
{
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)

View File

@ -74,5 +74,5 @@ TEST(FileSignalSource, InstantiateFileNotExists) {
config->set_property("Test.item_type", "gr_complex");
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);
}