diff --git a/src/DataSet/DataSet.cpp b/src/DataSet/DataSet.cpp index 2a1eee4630bbff00fce0aaee29cd1d8fe6ebfe88..4a176ea76ea982f4f415ade7ca133740a95f037d 100644 --- a/src/DataSet/DataSet.cpp +++ b/src/DataSet/DataSet.cpp @@ -22,8 +22,13 @@ namespace lib4neuro { DataSet::DataSet(std::string file_path) { std::ifstream ifs(file_path); if(ifs.is_open()) { - boost::archive::text_iarchive ia(ifs); - ia >> *this; + try { + boost::archive::text_iarchive ia(ifs); + ia >> *this; + }catch(boost::archive::archive_exception& e) { + THROW_RUNTIME_ERROR("Serialized archive error: '" + e.what() + "'! Please, check if your file is really " + "the serialized DataSet."); + } ifs.close(); } else { THROW_RUNTIME_ERROR("File " + file_path + " couldn't be open!");