use exceptions instead of hard abort

This commit is contained in:
Dennis Luxen
2013-08-05 17:28:57 +02:00
parent ec7d3a9885
commit 54302a53e1
23 changed files with 248 additions and 193 deletions
@@ -33,7 +33,9 @@ QueryObjectsStorage::QueryObjectsStorage(
) {
INFO("loading graph data");
std::ifstream hsgrInStream(hsgrPath.c_str(), std::ios::binary);
if(!hsgrInStream) { ERR(hsgrPath << " not found"); }
if(!hsgrInStream) {
throw OSRMException("hsgr not found");
}
//Deserialize road network graph
std::vector< QueryGraph::_StrNode> nodeList;
std::vector< QueryGraph::_StrEdge> edgeList;
@@ -79,7 +81,9 @@ QueryObjectsStorage::QueryObjectsStorage(
//deserialize street name list
INFO("Loading names index");
std::ifstream namesInStream(namesPath.c_str(), std::ios::binary);
if(!namesInStream) { ERR(namesPath << " not found"); }
if(!namesInStream) {
throw OSRMException("names file not found");
}
unsigned size(0);
namesInStream.read((char *)&size, sizeof(unsigned));
@@ -25,6 +25,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include<vector>
#include<string>
#include "../../Util/OSRMException.h"
#include "../../DataStructures/NodeInformationHelpDesk.h"
#include "../../DataStructures/QueryEdge.h"
#include "../../DataStructures/StaticGraph.h"