ina132: 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-10 12:36:50 -06:00 committed by Mihai Tudor Panu
parent 3fc672a19f
commit 6a6eaa1b71

View File

@ -23,7 +23,10 @@
*/
#include <iostream>
#include <string>
#include <stdexcept>
#include <unistd.h>
#include "ina132.h"
using namespace upm;
@ -33,7 +36,8 @@ INA132::INA132(int pin)
{
if ( !(m_aio = mraa_aio_init(pin)) )
{
cerr << __FUNCTION__ << ": mraa_aio_init() failed" << endl;
throw std::invalid_argument(std::string(__FUNCTION__) +
": mraa_aio_init() failed, invalid pin?");
return;
}
}