From 66d688bc90bff89de5640810e93eee7fd5a6a303 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Fri, 7 Aug 2015 15:52:06 -0600 Subject: [PATCH] ecs1030: remove custom exception and use a standard one Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/ecs1030/ecs1030.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/ecs1030/ecs1030.cxx b/src/ecs1030/ecs1030.cxx index f55c2f18..aa1c73a4 100644 --- a/src/ecs1030/ecs1030.cxx +++ b/src/ecs1030/ecs1030.cxx @@ -25,22 +25,18 @@ #include #include #include +#include +#include #include "ecs1030.h" using namespace upm; -struct ECS1030Exception : public std::exception { - std::string message; - ECS1030Exception (std::string msg) : message (msg) { } - ~ECS1030Exception () throw () { } - const char* what() const throw () { return message.c_str(); } -}; - ECS1030::ECS1030 (uint8_t pinNumber) { m_dataPinCtx = mraa_aio_init(pinNumber); if (m_dataPinCtx == NULL) { - throw ECS1030Exception ("GPIO failed to initilize"); + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_aio_init() failed"); } m_calibration = 111.1;