From 27d280d5c650f28509ac40f3a022363d6564dd44 Mon Sep 17 00:00:00 2001 From: Martin Beseda <martin.beseda@vsb.cz> Date: Sat, 29 Dec 2018 15:05:55 +0100 Subject: [PATCH] Simulator is now handling out-of-range exception thrown by CSVReader. --- src/examples/simulator.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/examples/simulator.cpp b/src/examples/simulator.cpp index 9a44df75..292f7068 100644 --- a/src/examples/simulator.cpp +++ b/src/examples/simulator.cpp @@ -43,8 +43,8 @@ int main(int argc, char** argv){ reader.read(); /* Create data set for both the training and testing of the neural network */ - std::vector<unsigned int> inputs = {1}; - std::vector<unsigned int> outputs = {17, 18, 19, 20, 21, 22, 23, 24, 25}; + std::vector<unsigned int> inputs = { 2, 3, 4, 5, 6, 7, 8, 27, 28, 29 }; + std::vector<unsigned int> outputs = {18, 19, 20, 21, 22, 23, 24, 25, 26}; l4n::DataSet ds = reader.get_data_set(&inputs, &outputs); ds.normalize(); @@ -124,9 +124,11 @@ int main(int argc, char** argv){ return 0; } catch(const std::runtime_error& e) { - std::cout << e.what(); - - return -1; + std::cerr << e.what(); + exit(EXIT_FAILURE); + } catch(const std::out_of_range& e) { + std::cerr << e.what(); + exit(EXIT_FAILURE); } } -- GitLab