a110x: 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 17:12:53 -06:00 committed by Mihai Tudor Panu
parent c50dd16d82
commit 6b4a3e1fd0

View File

@ -23,6 +23,8 @@
*/
#include <iostream>
#include <string>
#include <stdexcept>
#include "a110x.h"
@ -33,7 +35,8 @@ A110X::A110X(int pin)
{
if ( !(m_gpio = mraa_gpio_init(pin)) )
{
cerr << __FUNCTION__ << ": mraa_gpio_init() failed" << endl;
throw std::invalid_argument(std::string(__FUNCTION__) +
": mraa_gpio_init() failed, invalid pin?");
return;
}