Skip to content

Commit

Permalink
Catch exceptions by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
angriman committed Jun 27, 2019
1 parent 7f55a77 commit c70dbc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions networkit/cpp/io/GMLGraphReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ Graph GMLGraphReader::read(const std::string& path) {
nodeMap.insert(std::make_pair(pair.second,u));
DEBUG("added node: ",u,", ",pair.second);
}
} catch (std::exception e) {
//throw std::runtime_error("something went wrong when parsing a node");
} catch (const std::exception &e) {
return false;
}
std::getline(graphFile, line);
Expand Down Expand Up @@ -102,8 +101,7 @@ Graph GMLGraphReader::read(const std::string& path) {
} else if (pair.first == "target") {
v = nodeMap[pair.second];
}
} catch (std::exception e) {
//throw std::runtime_error("something went wrong when parsing an edge");
} catch (const std::exception &e) {
return false;
}
std::getline(graphFile,line);
Expand Down Expand Up @@ -142,7 +140,7 @@ Graph GMLGraphReader::read(const std::string& path) {
DEBUG("set directed to true");
}
break;
} catch (std::exception e) {
} catch (const std::exception &e) {
if (directed) {
G = Graph(0,false,true);
} else {
Expand Down
2 changes: 1 addition & 1 deletion networkit/cpp/io/METISParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static std::vector<std::pair<node,double>> parseWeightedLine(std::string line, c
std::tie(weight, it) = Aux::Parsing::strTo<double,decltype(it),Aux::Checkers::Enforcer>(it,end);
adjacencies.push_back(std::make_pair(v,weight));
content << v << " " << weight << "\t";
} catch (std::exception e) {
} catch (const std::exception &e) {
ERROR("malformed line; not all edges have been read correctly");
break;
}
Expand Down

0 comments on commit c70dbc2

Please sign in to comment.