From 26317cbd2a5d8141559cff18dbdd574b5998450a Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Fri, 11 Sep 2015 12:21:17 -0600 Subject: [PATCH] th02: throw exception(s) on fatal errors Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/th02/th02.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/th02/th02.cxx b/src/th02/th02.cxx index 2454791b..ae7230b6 100644 --- a/src/th02/th02.cxx +++ b/src/th02/th02.cxx @@ -55,8 +55,8 @@ TH02::getTemperature () { /* Start a new temperature conversion */ if (m_i2c.writeReg(TH02_REG_CONFIG, TH02_CMD_MEASURE_TEMP)) { - cerr << __FUNCTION__ << "@" << __LINE__ - << ": writeReg failed" << endl; + throw std::runtime_error(std::string(__FUNCTION__) + + ": I2c.writeReg() failed"); return 0.0; } @@ -76,8 +76,8 @@ TH02::getHumidity () { /* Start a new humidity conversion */ if (m_i2c.writeReg(TH02_REG_CONFIG, TH02_CMD_MEASURE_HUMI)) { - cerr << __FUNCTION__ << "@" << __LINE__ - << ": writeReg failed" << endl; + throw std::runtime_error(std::string(__FUNCTION__) + + ": I2c.writeReg() failed"); return 0.0; }