From 9bf954071bb0f7203ab3e8ad387a1acaa9b54705 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Fri, 7 Aug 2015 16:37:44 -0600 Subject: [PATCH] th02: remove custom exception and use standard ones Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/th02/th02.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/th02/th02.cxx b/src/th02/th02.cxx index 9c018c30..9861c54a 100644 --- a/src/th02/th02.cxx +++ b/src/th02/th02.cxx @@ -28,26 +28,21 @@ #include #include #include +#include #include "th02.h" using namespace std; using namespace upm; -struct TH02Exception : public std::exception { - std::string message; - TH02Exception (std::string msg) : message (msg) { } - ~TH02Exception () throw () { } - const char* what() const throw () { return message.c_str(); } -}; - TH02::TH02 (int bus, uint8_t addr) : m_i2c(bus) { m_addr = addr; m_name = "TH02"; mraa_result_t ret = m_i2c.address(m_addr); if (ret != MRAA_SUCCESS) { - throw TH02Exception ("Couldn't initilize I2C."); + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_i2c_address() failed"); } }