From 8d39b84dc58edd1239c11d5a2e890b2e3e355ea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <Pawel.Kedzia@pwr.wroc.pl>
Date: Thu, 29 Dec 2011 13:44:46 +0100
Subject: [PATCH] try/catch exception in corpusreader

---
 libcorpus2_whole/io/corpusreader.cpp | 8 ++++++--
 libcorpus2_whole/io/corpusreader.h   | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libcorpus2_whole/io/corpusreader.cpp b/libcorpus2_whole/io/corpusreader.cpp
index 8e53a7a..56538ad 100644
--- a/libcorpus2_whole/io/corpusreader.cpp
+++ b/libcorpus2_whole/io/corpusreader.cpp
@@ -13,8 +13,12 @@ CorpusReader::CorpusReader(const Tagset& tagset, const std::string& corpus_type)
 
 boost::shared_ptr<Corpus> CorpusReader::read(const std::string& corpus_file_path)
 {
-	boost::shared_ptr<CorpusReaderI> reader = this->get_corpus_reader_by_type();
-	return reader->read(corpus_file_path);
+	try {
+		boost::shared_ptr<CorpusReaderI> reader = this->get_corpus_reader_by_type();
+		return reader->read(corpus_file_path);
+	} catch(...) {
+		throw;
+	}
 }
 
 //
diff --git a/libcorpus2_whole/io/corpusreader.h b/libcorpus2_whole/io/corpusreader.h
index 633ecbb..dafe17b 100644
--- a/libcorpus2_whole/io/corpusreader.h
+++ b/libcorpus2_whole/io/corpusreader.h
@@ -35,7 +35,7 @@ private:
 
 private:
 	/// Type of corpus, sets only once in constructor
-	const std::string& corpus_type_;
+	const std::string corpus_type_;
 
 	/// Tagset to use, sets only onece in constructor
 	const Tagset& tagset_;
-- 
GitLab