From 6a88497a6e1580c91936700a47259d2379fc8e65 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Thu, 26 Jul 2012 14:06:33 +0000 Subject: [PATCH] Made load2D throw exception on error instead of calling 'exit', to allow error handling and not cause matlab to exit --- gtsam/slam/dataset.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gtsam/slam/dataset.cpp b/gtsam/slam/dataset.cpp index e1c282594..0502bb69b 100644 --- a/gtsam/slam/dataset.cpp +++ b/gtsam/slam/dataset.cpp @@ -90,10 +90,8 @@ pair load2D( bool addNoise, bool smart) { cout << "Will try to read " << filename << endl; ifstream is(filename.c_str()); - if (!is) { - cout << "load2D: can not find the file!"; - exit(-1); - } + if (!is) + throw std::invalid_argument("load2D: can not find the file!"); pose2SLAM::Values::shared_ptr poses(new pose2SLAM::Values); pose2SLAM::Graph::shared_ptr graph(new pose2SLAM::Graph);