gas: throw exception(s) on fatal errors

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Jon Trulson 2015-09-08 12:37:43 -06:00 committed by Mihai Tudor Panu
parent 48e6d4bcfa
commit 5f27c5515f

View File

@ -27,13 +27,16 @@
#include <stdlib.h>
#include <functional>
#include <string.h>
#include <stdexcept>
#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() {