Print diagnostic information to avoid boost cryptic errors
This commit is contained in:
parent
e92967167f
commit
669ac058b8
@ -10,6 +10,7 @@
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/spin_mutex.h>
|
||||
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/iostreams/device/mapped_file.hpp>
|
||||
#include <boost/spirit/include/phoenix.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
@ -91,6 +92,8 @@ template <typename Key, typename Value> struct CSVFilesParser
|
||||
private:
|
||||
// Parse a single CSV file and return result as a vector<Key, Value>
|
||||
auto ParseCSVFile(const std::string &filename, std::size_t file_id) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::iostreams::mapped_file_source mmap(filename);
|
||||
auto first = mmap.begin(), last = mmap.end();
|
||||
@ -119,6 +122,13 @@ template <typename Key, typename Value> struct CSVFilesParser
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
const auto message = boost::format("exception in loading %1%:\n %2%") %
|
||||
filename % boost::diagnostic_information(e);
|
||||
throw util::exception(message.str() + SOURCE_REF);
|
||||
}
|
||||
}
|
||||
|
||||
const std::size_t start_index;
|
||||
const KeyRule key_rule;
|
||||
|
Loading…
Reference in New Issue
Block a user