From aa3d9a9da0405e84e720870a13718b177d85652c Mon Sep 17 00:00:00 2001 From: Michael West Date: Wed, 20 Nov 2013 12:27:22 -0800 Subject: Added exception handling --- host/utils/b2xx_fx3_utils.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/host/utils/b2xx_fx3_utils.cpp b/host/utils/b2xx_fx3_utils.cpp index 50a294359..adacff9d0 100644 --- a/host/utils/b2xx_fx3_utils.cpp +++ b/host/utils/b2xx_fx3_utils.cpp @@ -228,7 +228,7 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) { if (vm.count("pid")) pid = atoh(pid_str); } catch (std::exception &e) { - std::cerr << "Exception while parsing VID and PID" << e.what() << std:: endl; + std::cerr << "Exception while parsing VID and PID: " << e.what() << std:: endl; return ~0; } @@ -250,7 +250,11 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) { std::cout << "Overwriting existing firmware" << std::endl; // reset the device - b200->reset_fx3(); + try { + b200->reset_fx3(); + } catch (std::exception &e) { + std::cerr << "Exception while reseting FX3: " << e.what() << std::endl; + } // re-open device b200.reset(); @@ -286,7 +290,7 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) { try { b200->load_firmware(fw_file); } catch (std::exception &e) { - std::cerr << "Exception while loading firmware" << e.what() << std::endl; + std::cerr << "Exception while loading firmware: " << e.what() << std::endl; return ~0; } @@ -415,7 +419,7 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) { try { b200->reset_fx3(); } catch (const std::exception &e) { - std::cerr << "Exceptions while resetting device: " << e.what() << std::endl; + std::cerr << "Exception while resetting device: " << e.what() << std::endl; return -1; } -- cgit v1.2.3