From 56ddb441d4976e9036938796252e5a81ea5264b5 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Thu, 10 Sep 2015 11:50:32 -0600 Subject: [PATCH] grovescam: throw exception(s) on fatal read() as well Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/grovescam/grovescam.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/grovescam/grovescam.cxx b/src/grovescam/grovescam.cxx index a90f8b7f..4b1d8e2c 100644 --- a/src/grovescam/grovescam.cxx +++ b/src/grovescam/grovescam.cxx @@ -119,7 +119,12 @@ int GROVESCAM::readData(uint8_t *buffer, int len) int rv = read(m_ttyFd, (char *)buffer, len); if (rv < 0) - cerr << __FUNCTION__ << ": read failed: " << strerror(errno) << endl; + { + throw std::runtime_error(std::string(__FUNCTION__) + + ": read() failed: " + + string(strerror(errno))); + return rv; + } return rv; }