mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-01 11:49:16 +00:00
Catch all exceptions
This commit is contained in:
parent
f8c7f1422b
commit
99f5c69afc
@ -23,20 +23,23 @@
|
|||||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||||
#include <volk_gnsssdr/volk_gnsssdr_prefs.h>
|
#include <volk_gnsssdr/volk_gnsssdr_prefs.h>
|
||||||
|
|
||||||
#include <ciso646>
|
//#include <ciso646>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/xpressive/xpressive.hpp>
|
#include <boost/xpressive/xpressive.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sys/stat.h>
|
//#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
//#include <sys/types.h>
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
// Adding program options
|
// Adding program options
|
||||||
|
try
|
||||||
|
{
|
||||||
boost::program_options::options_description desc("Options");
|
boost::program_options::options_description desc("Options");
|
||||||
desc.add_options()
|
desc.add_options()
|
||||||
("help,h", "Print help messages")
|
("help,h", "Print help messages")
|
||||||
@ -108,7 +111,7 @@ int main(int argc, char *argv[]) {
|
|||||||
update_mode = vm["update"].as<bool>();
|
update_mode = vm["update"].as<bool>();
|
||||||
dry_run = vm["dry-run"].as<bool>();
|
dry_run = vm["dry-run"].as<bool>();
|
||||||
}
|
}
|
||||||
catch (boost::program_options::error& error) {
|
catch (const boost::program_options::error & error) {
|
||||||
std::cerr << "Error: " << error.what() << std::endl << std::endl;
|
std::cerr << "Error: " << error.what() << std::endl << std::endl;
|
||||||
std::cerr << desc << std::endl;
|
std::cerr << desc << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@ -126,7 +129,7 @@ int main(int argc, char *argv[]) {
|
|||||||
try {
|
try {
|
||||||
filename = vm["json"].as<std::string>();
|
filename = vm["json"].as<std::string>();
|
||||||
}
|
}
|
||||||
catch (boost::bad_any_cast& error) {
|
catch (const boost::bad_any_cast& error) {
|
||||||
std::cerr << error.what() << std::endl;
|
std::cerr << error.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -137,7 +140,7 @@ int main(int argc, char *argv[]) {
|
|||||||
try {
|
try {
|
||||||
config_file = vm["path"].as<std::string>() + "/volk_config";
|
config_file = vm["path"].as<std::string>() + "/volk_config";
|
||||||
}
|
}
|
||||||
catch (boost::bad_any_cast& error) {
|
catch (const boost::bad_any_cast& error) {
|
||||||
std::cerr << error.what() << std::endl;
|
std::cerr << error.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -162,7 +165,7 @@ int main(int argc, char *argv[]) {
|
|||||||
try {
|
try {
|
||||||
kernel_expression = boost::xpressive::sregex::compile(kernel_regex);
|
kernel_expression = boost::xpressive::sregex::compile(kernel_regex);
|
||||||
}
|
}
|
||||||
catch (boost::xpressive::regex_error& error) {
|
catch (const boost::xpressive::regex_error& error) {
|
||||||
std::cerr << "Error occurred while compiling regex" << std::endl << std::endl;
|
std::cerr << "Error occurred while compiling regex" << std::endl << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -198,7 +201,7 @@ int main(int argc, char *argv[]) {
|
|||||||
run_volk_gnsssdr_tests(test_case.desc(), test_case.kernel_ptr(), test_case.name(),
|
run_volk_gnsssdr_tests(test_case.desc(), test_case.kernel_ptr(), test_case.name(),
|
||||||
test_case.test_parameters(), &results, test_case.puppet_master_name());
|
test_case.test_parameters(), &results, test_case.puppet_master_name());
|
||||||
}
|
}
|
||||||
catch (std::string error) {
|
catch (const std::string & error) {
|
||||||
std::cerr << "Caught Exception in 'run_volk_gnsssdr_tests': " << error << std::endl;
|
std::cerr << "Caught Exception in 'run_volk_gnsssdr_tests': " << error << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +224,12 @@ int main(int argc, char *argv[]) {
|
|||||||
std::cout << "Warning: this was a dry-run. Config not generated" << std::endl;
|
std::cout << "Warning: this was a dry-run. Config not generated" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(const boost::exception & e)
|
||||||
|
{
|
||||||
|
std::cerr << boost::diagnostic_information(e) << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void read_results(std::vector<volk_gnsssdr_test_results_t> *results)
|
void read_results(std::vector<volk_gnsssdr_test_results_t> *results)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user