Made load2D throw exception on error instead of calling 'exit', to allow error handling and not cause matlab to exit

release/4.3a0
Richard Roberts 2012-07-26 14:06:33 +00:00
parent 5c22654194
commit 6a88497a6e
1 changed files with 2 additions and 4 deletions

View File

@ -90,10 +90,8 @@ pair<pose2SLAM::Graph::shared_ptr, pose2SLAM::Values::shared_ptr> load2D(
bool addNoise, bool smart) { bool addNoise, bool smart) {
cout << "Will try to read " << filename << endl; cout << "Will try to read " << filename << endl;
ifstream is(filename.c_str()); ifstream is(filename.c_str());
if (!is) { if (!is)
cout << "load2D: can not find the file!"; throw std::invalid_argument("load2D: can not find the file!");
exit(-1);
}
pose2SLAM::Values::shared_ptr poses(new pose2SLAM::Values); pose2SLAM::Values::shared_ptr poses(new pose2SLAM::Values);
pose2SLAM::Graph::shared_ptr graph(new pose2SLAM::Graph); pose2SLAM::Graph::shared_ptr graph(new pose2SLAM::Graph);