From 5f27c5515fec68bad52a35c4f0327cb3f45240aa Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Tue, 8 Sep 2015 12:37:43 -0600 Subject: [PATCH] gas: throw exception(s) on fatal errors Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/gas/gas.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gas/gas.cxx b/src/gas/gas.cxx index 1d256825..c6b5144c 100644 --- a/src/gas/gas.cxx +++ b/src/gas/gas.cxx @@ -27,13 +27,16 @@ #include #include #include +#include #include "gas.h" using namespace upm; Gas::Gas(int gasPin) { // initialise analog gas input - m_gasCtx = mraa_aio_init(gasPin); + if (!(m_gasCtx = mraa_aio_init(gasPin))) + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_aio_init() failed, invalid pin?"); } Gas::~Gas() {