Commit f69a9343 authored by Mikaël Salson's avatar Mikaël Salson

algo/: Remove g++-8 warning on catching exceptions

With g++-8 we had a “warning: catching polymorphic type * by value”.
This is solved by using a reference
parent f2a6b18f
Pipeline #30109 passed with stages
in 54 seconds
......@@ -304,7 +304,7 @@ void MultiGermline::build_from_json(string path, string json_filename_and_filter
germlines = json::parse(content);
} catch (const invalid_argument e) {
} catch (const invalid_argument &e) {
cerr << ERROR_STRING << "Vidjil cannot open .g file " << path + "/" + json_filename << ": " << e.what() << endl;
exit(1);
}
......
......@@ -32,7 +32,7 @@ public:
IKmerStore<T> *index;
try{
index = new ArrayKmerStore<T>(seed, revcomp);
}catch(exception e){
}catch(exception &e){
cout << " (using a MapKmer to fit into memory)" << endl;
index = new MapKmerStore<T>(seed, revcomp);
}
......
......@@ -33,7 +33,7 @@ WindowsStorage *WindowExtractor::extract(OnlineBioReader *reads,
try {
reads->next();
}
catch (const invalid_argument e) {
catch (const invalid_argument &e) {
cout << endl;
cerr << WARNING_STRING << "Error in getting a new read: " << e.what() << endl;
cerr << WARNING_STRING << "Vidjil stops the analysis here, after " << nb_reads << " reads." << endl;
......
......@@ -103,7 +103,7 @@ void testFastaAddThrows() {
bool caught = false;
try {
BioReader fa1("mlkdkklflskjfskldfj.fa");
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("Error in opening file") != string::npos, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -114,7 +114,7 @@ void testFastaAddThrows() {
caught = false;
try {
fa1.add("ljk:lkjsdfsdlfjsdlfkjs.fa");
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("Error in opening file") != string::npos, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -123,7 +123,7 @@ void testFastaAddThrows() {
caught = false;
try {
fa1.add("Makefile");
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("The file seems to be malformed") != string::npos, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -133,7 +133,7 @@ void testFastaAddThrows() {
try {
OnlineBioReader *fa = OnlineBioReaderFactory::create("lkjdflkdfjglkdfjg.fa");
delete fa;
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("Error in opening file") != string::npos, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -142,7 +142,7 @@ void testFastaAddThrows() {
caught = false;
try {
BioReader fa1("data/malformed1.fq");
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("Expected line starting with +") != string::npos, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -150,7 +150,7 @@ void testFastaAddThrows() {
caught = false;
try {
BioReader fa1("data/malformed2.fq");
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("Unexpected EOF") == 0, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -158,7 +158,7 @@ void testFastaAddThrows() {
caught = false;
try {
BioReader fa1("data/malformed3.fq");
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("Quality and sequence don't have the same length") == 0, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -166,7 +166,7 @@ void testFastaAddThrows() {
caught = false;
try {
BioReader fa1("data/malformed4.fq");
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("Unexpected EOF") == 0, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -174,7 +174,7 @@ void testFastaAddThrows() {
caught = false;
try {
BioReader fa1("data/malformed5.fq");
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
TAP_TEST(string(e.what()).find("Unexpected EOF") == 0, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......@@ -186,7 +186,7 @@ void testFastaAddThrows() {
// don't complain for empty files explicitly in BioReader constructor.
fa_read = OnlineBioReaderFactory::create("data/malformed6.fq");
fa_read->next();
} catch (invalid_argument e) {
} catch (invalid_argument &e) {
if (fa_read)
delete fa_read;
TAP_TEST(string(e.what()).find("Unexpected EOF") == 0, TEST_FASTA_INVALID_FILE, "");
......@@ -197,7 +197,7 @@ void testFastaAddThrows() {
caught = false;
try {
BioReader fa1("data/malformed7.fq");
} catch(invalid_argument e) {
} catch(invalid_argument &e) {
TAP_TEST(string(e.what()).find("Unexpected EOF") == 0, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
......
......@@ -876,7 +876,7 @@ int main (int argc, char **argv)
try {
reads = OnlineBioReaderFactory::create(f_reads, 1, read_header_separator, max_reads_processed, only_nth_read);
} catch (const invalid_argument e) {
} catch (const invalid_argument &e) {
cerr << ERROR_STRING << PROGNAME << " cannot open reads file " << f_reads << ": " << e.what() << endl;
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment